User level CLOS API collection library.
Name must be symbol or identifier.
Supers must be list of class.
Slots must be following structure:
slots ::= (slot ...)
slot ::= (slot-name specifiers*)
specifiers ::= :init-keyword
keyword
| :init-value
value
| :init-form
form
| :reader
reader-function
| :writer
writer-function
Defines a new class.
Slot specifiers:
-
:init-keyword
- This keyword specifies initialisation keyword argument used by the
make
procedure. Following code describes how to use:
(make <a-class> :slot-a 'slot-a-value)
<a-class>
has a slot which slot definition contains the keyword
:init-keyword
with the keyword :slot-a. The code initialises
an instance of the slot with given value slot-a-value.
-
:init-value
- This keyword specifies an initial value of target slot.
-
:init-form
- Similar with
:init-keyword
but this keyword takes expression which
will be evaluated at initialiation time.
-
:reader
- This keyword creates a procedure takes 1 argument an instance of the class
to access the slot, so users can read the slot without using
slot-ref
procedure.
-
:writer
- This keyword creates a procedure takes 2 argument an instance of the class
and object to set the slot value with given object, so users can set the
slot without using
slot-set!
procedure.
opttions can specify the metaclass of this class with keyword
:metaclass
.
NOTE: Current implementation does not support
:allocation
keyword
by default. If you need it, see
(sagittarius mop allocation).
Name must be symbol.
Creates a new generic function.
Name must be symbol.
Specifiers must be following structure:
specifiers ::= (spec ... rest)
spec ::= (argument-name class) | (argument-name)
rest ::= '() | symbol
Adds defined method to
name generic. If the generic does not exist, this
will create a new generic function implicitly.
Returns the slot value specified slot-name.
Sets the slot value value with specified slot-name.
Returns #t if the slot value specified slot-name is bounded,
otherwise #f.
Generic
make
class args ...
Creates a new instance of class
Function
is-a?
object class
Returns #t if object is an instance of class, otherwise #f.
Returns #t if class1 is a subclass of class2, otherwise #f.
This procedure is for MOP.
Returns the slot value got by
accessor.
This procedure is for MOP.
Sets the slot value
value to
object using
accessor.
This procedure is for MOP.
Returns the slot value according to the given
class.
It is an error if the given
slot-name doesn't exist in the
class.
This procedure is for MOP.
Sets the slot value
value to
object accoring to the given
class.
It is an error if the given
slot-name doesn't exist in the
class.
This procedure is for MOP.
Returns #t if the slot is bounded according to the given
class,
otherwise #f.
It is an error if the given
slot-name doesn't exist in the
class.
This method will be called when writing the given
object.
Defines how user defined class should be written.
This method will be called when
equal?
is called.
Defines how user defined class should be compared.