[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
All defined classes, if created as a superclass (With no specified
parent class) will actually inherit from a special superclass stored in
eieio-default-superclass
. This superclass is actually quite
simple, but with it, certain default methods or attributes can be added
to all objects at any time, without updating their code in the future
(If there is a change). In CLOS, this would be named
STANDARD-CLASS
and is aliased.
Currently, the default superclass is defined as follows:
(defclass eieio-default-superclass nil nil ) "Default class used as parent class for superclasses. It's slots are automatically adopted by such superclasses but not stored in the `parent' slot. When searching for attributes or methods, when the last parent is found, the search will recurse to this class.") |
When creating an object of any type, you can use it's constructor, or
make-instance
. This, in turns calls the method
initialize-instance
, which then calls the method
shared-initialize
.
shared-initialize
.
These methods are used to override errors:
invalid-slot-name
. See section 11. Signals.
You may override this behavior, but it is not expected to return in the current implementation.
This function takes arguments in a different order than in CLOS.
unbound-slot
signal. If
overridden it's return value will be returned from the function
attempting to reference its value.
no-method-definition
signal. The return value of this function
becomes the return value of the non-existent method.
call-next-method
is
made, and there is no next method that can be called. The return
value becomes the return value of call-next-method
.
Additional useful methods are:
initialize-instance
. The only
other change is to modify the name with an incrementing numeric.
#<class-name "objname"> |
(defclass data-object () (value) "Object containing one data slot.") (defmethod object-print ((this data-object) &optional strings) "Return a string with a summary of the data object as part of the name." (apply 'call-next-method this (cons (format " value: %s" (render this)) strings))) |
here is what some output could look like:
(object-print test-object) => #<data-object test-object value: 3> |
read
and
eval
to recover the object. Only slots with :initarg
s
are written to the stream.
[ << ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This document was generated by XEmacs shared group account on December, 19 2009
using texi2html 1.65.