(goops.info.gz) Class Definition Internals
Info Catalog
(goops.info.gz) Slot Options
(goops.info.gz) Defining New Classes
(goops.info.gz) Customizing Class Definition
Class Definition Internals
--------------------------
Implementation notes: `define-class' expands to an expression which
* checks that it is being evaluated only at top level
* defines any accessors that are implied by the SLOT-DEFINITIONs
* uses `class' to create the new class ( class Class
Definition Internals.)
* checks for a previous class definition for NAME and, if found,
handles the redefinition by invoking `class-redefinition' (
Redefining a Class).
- syntax: class name (super ...) slot-definition ... . options
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 Basic Class Definition.
Implementation notes: `class' expands to an expression which
* processes the class and slot definition options to check that they
are well-formed, to convert the `#:init-form' option to an
`#:init-thunk' option, to supply a default environment parameter
(the current top-level environment) and to evaluate all the bits
that need to be evaluated
* calls `make-class' to create the class with the processed and
evaluated parameters.
- procedure: make-class supers slots . options
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 Basic Class
Definition, 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'
* adds `<object>' to the SUPERS list if SUPERS is empty or if none
of the classes in SUPERS have `<object>' in their class precedence
list
* defaults the `#:environment', `#:name' and `#:metaclass' options,
if they are not specified by OPTIONS, to the current top-level
environment, the unbound value, and `(ensure-metaclass SUPERS)'
respectively ( ensure-metaclass Class Definition Internals.)
* checks for duplicate classes in SUPERS and duplicate slot names in
SLOTS, and signals an error if there are any duplicates
* calls `make', passing the metaclass as the first parameter and all
other parameters as option keywords with values.
- procedure: ensure-metaclass supers env
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.
- procedure: ensure-metaclass-with-supers meta-supers
`ensure-metaclass-with-supers' is an internal procedure used by
`ensure-metaclass' ( ensure-metaclass Class Definition
Internals.). 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.
Info Catalog
(goops.info.gz) Slot Options
(goops.info.gz) Defining New Classes
(goops.info.gz) Customizing Class Definition
automatically generated byinfo2html