(rontolisp) docs
← cl Package Functions

find-class

(find-class symbol &optional (errorp t) environment)

Returns the class metaobject named by symbol -- a standard-class instance whose slots the class-name / closer-mop readers (class-slots, slot-definition-name, ...) consume. The answer is memoized, so two calls for the same class return the same (eq) object -- the same object class-of answers for an instance of that class. When no class is named symbol, an error is signaled unless errorp is nil, in which case nil is returned; environment is ignored. The known classes are every defclass / define-condition / defstruct in the program, the built-in condition hierarchy, and the built-in classes: the ones class-of answers (integer, ratio, float, complex, string, character, symbol, keyword, cons, null, boolean, hash-table, function, vector, array, t) plus the INTERIOR of the lattice, which is reachable by name only because class-of always has a narrower answer for it (sequence, list, number, real, rational, bit-vector, structure-object, built-in-class, standard-object). A built-in class metaobject carries no slots and no superclasses -- standing where a type specifier is expected it means the same set as its name, so typep and subtypep hold the lattice, not the metaobject. On the compiled backends the class set is fixed at compile time; classes built from runtime data do not exist.

(setf (find-class alias) class) registers class under a second name: after it, find-class, make-instance, typep, subtypep and a handler-case clause all resolve the alias to the very same class (the metaobject is eq). Only this aliasing shape is supported -- the value must be a literal (find-class 'target) naming an already defined class -- and only at top level, because the compiled backends build their class table at compile time.