|[ < ]||[ > ]||[ << ]||[ Up ]||[ >> ]||[Top]||[Contents]||[Index]||[ ? ]|
A class in EIEIO has a similar structure to that found in other
languages. A new class is created with
This function is specified by CLOS, and EIEIO conforms in structure.
Creates a new class called
class-name. The created variable's
documentation string is set to a modified version of the doc string
found in options-or-doc. Each time a slot is defined the
variables documentation string is updated to include the methods
documentation as well.
The parent class for
class-name is superclass-list which
must be a list. Each element of this list must be a class. These
classes form the parents of the class being created. Every slot in
parent is replicated in the new class. If two parents share the same
slot name, the parent which appears in the list first sets the attributes
for that slot. If a slot in the new class' slot list matches a parent,
then the new specifications for the child class override that of the
slot-list is a list of lists. Each sublist defines an attribute.
These lists are of the form
(name :tag1 value1 :tag2 value2 :tagn
valuen). Some valid CLOS tags are:
:initform (1 2 3)
Lastly, using the function
lambda-default instead of
lambda will let you specify a lambda expression to use as the
value, without evaluation.
(or null symbol)
Some tags whose behaviors do not yet match CLOS are:
Some tags which are unique to EIEIO are:
defcustomfor details. This specifier is equivalent to the :type field of a
defcustom's :group command, this organizes different slots in an object into groups. When customizing an object, only the slots belonging to a specific group need be worked with, simplifying the size of the display.
When using a slot referencing function, if the value behind slot is private or protected, then the current scope of operation must be within a method of the calling object.
Valid values are:
Additionally, CLOS style class options are available. These are various options attached to a class. These options can occur in place or in addition to a documentation string. If both occur, then the options appear before the documentation string. In CLOS, documentation is one of the options available to a class, so the ability to have a standalone documentation string is specific to Emacs.
Possible class options are:
If this option is non-nil, and the
:type is specifies something such as
string then allow
this to pass. The default is to have this option be off. This is
implemented as an alternative to unbound slots.
Tags a class as being abstract, or uninstantiable.
class-optioncommand, however, to see what groups are available.
See section 2. CLOS compatibility, for more details on CLOS tags versus EIEIO specific tags.
The whole definition may look like this:
(defclass data-object () ((value :initarg :value :initform nil :accessor get-value :documentation "Lisp object which represents the data this object maintains." :protection :protected) (reference :initarg :reference :initform nil :type list :custom (repeat object) :documentation "List of objects looking at this object. The method `update-symbol' is called for each member of `reference' whenever `value' is modified." :protection :protected) ) "Data object which tracks referencers.")
defclasswill throw an error if a tag in a slot specifier is unsupported.
|[ << ]||[ >> ]||[Top]||[Contents]||[Index]||[ ? ]|
Conform with <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html40/loose.dtd">
Automatically validated by PSGML