eieio: Predicates
8 Predicates and Utilities
**************************
Now that we know how to create classes, access slots, and define
methods, it might be useful to verify that everything is doing ok. To
help with this a plethora of predicates have been created.
-- Function: find-class symbol &optional errorp
Return the class that SYMBOL represents. If there is no class,
‘nil’ is returned if ERRORP is ‘nil’. If ERRORP is non-‘nil’,
‘wrong-argument-type’ is signaled.
-- Function: class-p class
Return ‘t’ if CLASS is a valid class vector. CLASS is a symbol.
-- Function: slot-exists-p object-or-class slot
Non-‘nil’ if OBJECT-OR-CLASS has SLOT.
-- Function: slot-boundp object slot
Non-‘nil’ if OBJECT’s SLOT is bound. Setting a slot’s value makes
it bound. Calling “slot-makeunbound” will make a slot unbound.
OBJECT can be an instance or a class.
-- Function: eieio-class-name class
Return a string of the form ‘#<class myclassname>’ which should
look similar to other Lisp objects like buffers and processes.
Printing a class results only in a symbol.
-- Function: class-option class option
Return the value in CLASS of a given OPTION. For example:
(class-option eieio-default-superclass :documentation)
Will fetch the documentation string for ‘eieio-default-superclass’.
-- Function: eieio-object-name obj
Return a string of the form ‘#<object-class myobjname>’ for OBJ.
This should look like Lisp symbols from other parts of Emacs such
as buffers and processes, and is shorter and cleaner than printing
the object’s vector. It is more useful to use ‘object-print’ to
get and object’s print form, as this allows the object to add extra
display information into the symbol.
-- Function: eieio-object-class obj
Returns the class symbol from OBJ.
-- Function: eieio-object-class-name obj
Returns the symbol of OBJ’s class.
-- Function: eieio-class-parents class
Returns the direct parents class of CLASS. Returns ‘nil’ if it is
a superclass.
-- Function: eieio-class-parents-fast class
Just like ‘eieio-class-parents’ except it is a macro and no type
checking is performed.
-- Function: eieio-class-parent class
Deprecated function which returns the first parent of CLASS.
-- Function: eieio-class-children class
Return the list of classes inheriting from CLASS.
-- Function: eieio-class-children-fast class
Just like ‘eieio-class-children’, but with no checks.
-- Function: same-class-p obj class
Returns ‘t’ if OBJ’s class is the same as CLASS.
-- Function: same-class-fast-p obj class
Same as ‘same-class-p’ except this is a macro and no type checking
is performed.
-- Function: object-of-class-p obj class
Returns ‘t’ if OBJ inherits anything from CLASS. This is different
from ‘same-class-p’ because it checks for inheritance.
-- Function: child-of-class-p child class
Returns ‘t’ if CHILD is a subclass of CLASS.
-- Function: generic-p method-symbol
Returns ‘t’ if ‘method-symbol’ is a generic function, as opposed to
a regular Emacs Lisp function.