Next: Specializers, Previous: Predefined Classes, Up: Classes [Contents][Index]
SOS allows generic procedures to discriminate on record types.
This means that a record structure defined by means of
make-record-type
or define-structure
can be passed as an
argument to a generic procedure, and the generic procedure can use the
record’s type to determine which method to be invoked.2
In order to support this, SOS accepts record type descriptors in all contexts that accept classes. Additionally, every record type descriptor has an associated SOS class; either the class or the record type can be used with equivalent results.
Record-type must be a record type descriptor (in other words, it
must satisfy the predicate record-type?
). Returns the class
associated with record-type.
Record must be a record (in other words, it must satisfy the
predicate record?
). Returns the class associated with
record. This is equivalent to
(record-type-class (record-type-descriptor record))
If the
type
option of define-structure
is used, the resulting
data structure is not a record and thus cannot be used in this
manner.