Next: Slot Access Procedures, Previous: Slot Access Methods, Up: Slots [Contents][Index]
For convenience, and for consistency with the record-accessor procedures
record-accessor
and record-modifier
, each of the above
method-generating procedures has a corresponding accessor-generator.
Each of these procedures creates a generic procedure, adds an
appropriate method to it by calling the corresponding method-generating
procedure, and returns the generic procedure. Thus, for example, the
following are equivalent:
(slot-accessor <foo> 'bar) (let ((g (make-generic-procedure 1))) (add-method g (slot-accessor-method <foo> 'bar)) g)
Returns a generic procedure of one argument that is an accessor for the
slot name in class. The argument to the returned procedure
must be an instance of class. When the procedure is called, it
returns the contents of the slot name in that instance; if the
slot is uninitialized, an error of type
condition-type:uninitialized-slot
is signalled.
Returns a generic procedure of two arguments that is a modifier for the slot name in class. The first argument to the returned procedure must be an instance of class, and the second argument may be any object. When the procedure is called, it modifies the slot name in the instance to contain the second argument.
Returns a generic procedure of one argument that is an
“initialized?” predicate for the slot name in class.
The argument to the returned procedure must be an instance of
class. When the procedure is called, it returns #t
if the
slot name in that instance is initialized, otherwise it returns
#f
.
Next: Slot Access Procedures, Previous: Slot Access Methods, Up: Slots [Contents][Index]