A new classndexfile(index-entry "class" "rm" main ) is defined with the define-classndexfile(index-entry "define-class" "tt" aux ) macro. The syntax of define-class is close to CLOS defclass:
unspecified
error
makeotherˆ`=̀13`
gobblecr(define-class class (superclass1 superclass2...) (slot description1 slot description2...) metaclass option)
The metaclass option will not be discussed in this appendix.
The superclasses list specifies the super classes of class (see
for more details).
A slot description gives the name of a slotndexfile(index-entry "slot" "rm" main ) and,
eventually, some ``properties'' of this slot (such as its initial value, the
function which permit to access its value, ...). Slot descriptions will be
discussed in
.
As an exemple, consider now that we have to define a complex number. This can be done with the following class definition:
unspecified
error
makeotherˆ`=̀13`
gobblecr(define-class <complex> (<number>) (r i))
This binds the symbol <complex> to a new class whose instances contain two slots. These slots are called r an i and we suppose here that they contain respectively the real part and the imaginary part of a complex number. Note that this class inherits from <number> which is a pre-defined class (<number> is the super class of the <real> and <integer> pre-defined classes).1.