First off, please note that this manual cannot serve as a complete introduction to object oriented programming and generic functions in LISP. Although EIEIO is not a complete implementation of the Common Lisp Object System (CLOS) and also differs from it in several aspects, it follows the same basic concepts. Therefore, it is highly recommended to learn those from a textbook or tutorial first, especially if you only know OOP from languages like C++ or Java. If on the other hand you are already familiar with CLOS, you should be aware that EIEIO does not implement the full CLOS specification and also differs in some other aspects which are mentioned below (also see CLOS compatibility).
EIEIO supports the following features:
Due to restrictions in the Emacs Lisp language, CLOS cannot be completely supported, and a few functions have been added in place of setf. Here are some important CLOS features that EIEIO presently lacks:
EIEO does not support method dispatch for built-in types and multiple arguments types. In other words, method dispatch only looks at the first argument, and this one must be an EIEIO type.
There is just one default metaclass,
and you cannot define your own. The
:metaclass tag in
defclass is ignored. Also, functions like
should return instances of the metaclass, behave differently in
EIEIO in that they return symbols or plain structures instead.
EIEIO does not support it.
This CLOS method tag is non-functional.
Each slot can have an
:initform tag, so this is not really necessary.
Each class contains a mock object used for fast initialization of instantiated objects. Using functions with side effects on object slot values can potentially cause modifications in the mock object. EIEIO should use a deep copy but currently does not.