next up previous

9.6.4 Setting Slots

Sources external to an object, such as a rule or deffunction, can write an object's slots only by sending the object a message. Several functions also exist which operate implicitly on the active instance for a message that can only be called by message-handlers, such as dynamic-put (see section 12.16.4.11). The bind function can also be used to set a slot's value from within a message-handler (see section 9.4.2).

Example

CLIPS> (clear)
CLIPS>
(defclass A (is-a USER)
    (role concrete)
    (slot x (create-accessor write)
          (default abc)))
CLIPS> (make-instance a of A)
[a]
CLIPS> (send [a] put-x "New value.")
ìNew value.î
CLIPS>


next up previous