chickadee » tinyclos » set!

slot-set! INSTANCE SLOT-NAME VALUEprocedure
(set! (slot-ref INSTANCE SLOT-NAME) VALUE)setter

Sets the value of the slot SLOT-NAME of the object INSTANCE to VALUE.

Note that a SLOT-NAME is not required to be a symbol, so the following is perfectly valid:

(define hidden-slot (list 'hidden))
(define <myclass>
  (make <class>
        'direct-supers (list <object>)
        'direct-slots (list hidden-slot) ) )
(define x1 (make <myclass>)
(slot-set! x1 hidden-slot 99)

To exploit this, however, the make call has to be used as above. define-class only supports symbolic slot names.