Basic notions

This section describes basic concepts of our object extension on a small example. Definition of a new object class is done with the defclass form. For instance,

    (defclass person ()
       ((name :initarg :name
              :accessor name 
        (age  :initarg :age))))
defines a person characteristics. Two slots are declared: name and age. Characteristics of a slot are expressed with its definition. Here, for instance, it is said that the slot name can be inited with the keyword :name upon instance creation and that an accessor function should be generated for it. Creation of a new instance is done with the make constructor:
    (define p (make person 
                   :name "Smith"
                   :age 42))
This call permits to build a new person and to initialize the slots which compose him/her.

Reading the value of a slot can be done with the function slot-value. For instance,

    (slot-value p 'age)
permits to get the value of slot age of the p object. Setting this slot can be done by using the generalized set! defined in STK :
    (set! (slot-value p 'age) 43)
Since an accessor as also been defined on the name slot, it can be read with the following expression:
    (name p)
As before, slot setting can be done with the generalized set! as in
    (set! (name p) 43)