defclass
defclass is a Lisp macro in `eieio.el
'.
(defclass NAME SUPERCLASS SLOTS &rest OPTIONS-AND-DOC)
Define NAME as a new class derived from SUPERCLASS with SLOTS.
OPTIONS-AND-DOC is used as the class' options and base documentation.
SUPERCLASS is a list of superclasses to inherit from, with SLOTS
being the slots residing in that class definition. NOTE: Currently
only one slot may exist in SUPERCLASS as multiple inheritance is not
yet supported. Supported tags are:
:initform - Initializing form.
:initarg - Tag used during initialization.
:accessor - Tag used to create a function to access this slot.
:allocation - Specify where the value is stored.
Defaults to `:instance', but could also be `:class'.
:writer - A function symbol which will `write' an object's slot.
:reader - A function symbol which will `read' an object.
:type - The type of data allowed in this slot (see `typep').
:documentation
- A string documenting use of this slot.
The following are extensions on CLOS:
:protection - Specify protection for this slot.
Defaults to `:public'. Also use `:protected', or `:private'.
:custom - When customizing an object, the custom :type. Public only.
:label - A text string label used for a slot when customizing.
:group - Name of a customization group this slot belongs in.
:printer - A function to call to print the value of a slot.
See `eieio-override-prin1' as an example.
A class can also have optional options. These options happen in place
of documentation (including a :documentation tag), in addition to
documentation, or not at all. Supported options are:
:documentation - The doc-string used for this class.
Options added to EIEIO:
:allow-nil-initform - Non-nil to skip typechecking of null initforms.
:custom-groups - List of custom group names. Organizes slots into
reasonable groups for customizations.
:abstract - Non-nil to prevent instances of this class.
If a string, use as an error string if someone does
try to make an instance.
:method-invocation-order
- Control the method invocation order if there is
multiple inheritance. Valid values are:
:breadth-first - The default.
:depth-first
Options in CLOS not supported in EIEIO:
:metaclass - Class to use in place of `standard-class'
:default-initargs - Initargs to use when initializing new objects of
this class.
Due to the way class options are set up, you can add any tags you wish,
and reference them using the function `class-option'.