Node:Class Definition Internals, Next:, Previous:Slot Options, Up:Defining New Classes



3.2.4 Class Definition Internals

Implementation notes: define-class expands to an expression which

class name (super ...) slot-definition ... . options syntax
Return a newly created class that inherits from supers, with direct slots defined by slot-definitions and class options options. For the format of slot-definitions and options, see define-class.

Implementation notes: class expands to an expression which

make-class supers slots . options procedure
Return a newly created class that inherits from supers, with direct slots defined by slots and class options options. For the format of slots and options, see define-class, except note that for make-class, slots and options are separate list parameters: slots here is a list of slot definitions.

Implementation notes: make-class

ensure-metaclass supers env procedure
Return a metaclass suitable for a class that inherits from the list of classes in supers. The returned metaclass is the union by inheritance of the metaclasses of the classes in supers.

In the simplest case, where all the supers are straightforward classes with metaclass <class>, the returned metaclass is just <class>.

For a more complex example, suppose that supers contained one class with metaclass <operator-class> and one with metaclass <foreign-object-class>. Then the returned metaclass would be a class that inherits from both <operator-class> and <foreign-object-class>.

If supers is the empty list, ensure-metaclass returns the default GOOPS metaclass <class>.

GOOPS keeps a list of the metaclasses created by ensure-metaclass, so that each required type of metaclass only has to be created once.

The env parameter is ignored.

ensure-metaclass-with-supers meta-supers procedure
ensure-metaclass-with-supers is an internal procedure used by ensure-metaclass (see ensure-metaclass). It returns a metaclass that is the union by inheritance of the metaclasses in meta-supers.

The internals of make, which is ultimately used to create the new class object, are described in Customizing Instance Creation, which covers the creation and initialization of instances in general.