[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2. CLOS compatibility

As you read this, it is important to know that I have just recently learned some of the CLOS syntax, but have never used it myself outside of the EIEIO framework. I'm primarily and Emacs Lisp hacker who wrote EIEIO to help myself learn some of the mechanics of Object Oriented programming.

Currently, the following functions should behave almost as expected from CLOS.

defclass
All slot keywords are available but not all work correctly. Slot keyword differences are:

:reader, and :writer tags
Create methods that throw errors instead of creating an unqualified method. You can still create new ones to do its business.
:accessor
This should create an unqualified method to access a slot, but instead pre-builds a method that gets the slot's value.
:type
Specifier uses the typep function from the `cl' package. @xref{(cl)Type Predicates}. It therefore has the same issues as that package. Extensions include the ability to provide object names.

Defclass also supports class options, but does not currently use values of :metaclass, and :default-initargs.

make-instance
Make instance works as expected, however it just uses the EIEIO instance creator automatically generated when a new class is created. See section 5. Making New Objects.
defgeneric
Creates the desired symbol, and accepts all of the expected arguments except :AROUND.
defmethod
Calls defgeneric, and accepts most of the expected arguments. Only the first argument to the created method may be type cast, though any argument can be syntactically type cast. (And promptly ignored) To type cast against a class, the class must exist before defmethod is called. In addition, the :AROUND tag is not supported.
call-next-method
Inside a method, calls the next available method up the inheritance tree for the given object. This is different than that found in CLOS because in EIEIO this function accepts replacement arguments. This permits subclasses to modify arguments as they are passed up the tree. If no arguments are given, the expected CLOS behavior is used.
setf
If the common-lisp subsystem is loaded, the setf parameters are also loaded so the form (setf (slot-value object slot) t) should work.

CLOS supports the describe command, but eieio only provides eieio-describe-class, and eieio-describe-generic. These functions are adviced into describe-variable, and describe-function.

When creating a new class (see section 3. Building Classes) there are several new keywords supported by EIEIO.

In EIEIO tags are in lower case, not mixed case.


[ << ] [ >> ]           [Top] [Contents] [Index] [ ? ]

This document was generated by XEmacs shared group account on December, 19 2009 using texi2html 1.65.