next up previous

9.6.3 Reading Slots

Sources external to an object, such as a rule or deffunction, can read an object's slots only by sending the object a message. Message-handlers executing on the behalf of an object can either use messages or direct access to read the object's slots (see section 9.4.2). 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-get (see section 12.16.4.10).

Section 12.16 describes ways of testing for the existence of slots and their values.

Example

CLIPS> (clear)
CLIPS>
(defclass A (is-a USER)
    (role concrete)
    (slot x (create-accessor read)
          (default abc)))
CLIPS> (make-instance a of A)
[a]
CLIPS> (sym-cat (send [a] get-x) def)
abcdef
CLIPS>


next up previous