next up previous

9.3.3.10 OverrideMessage Facet

There are several COOL support functions which set slots via use of message-passing, e.g., make-nstance, initialize-instance, message-modify-instance and message-duplicate-instance. By default, all these functions attempt to set a slot with the message called put<slotname>. However, if the user has elected not to use standard slot-accessors and wishes these functions to be able to perform slot-overrides, then the override-message facet can be used to indicate what message to send instead.

Example

CLIPS> (clear)
CLIPS>
(defclass A (is-a USER)
  (role concrete)
  (slot special (override-message special-put)))
CLIPS>
(defmessage-handler A special-put primary (?value)
  (bind ?self:special ?value))
CLIPS> (watch messages)
CLIPS> (make-instance a of A (special 65))
MSG >> special-put ED:1 (<Instance-a> 65)
MSG << special-put ED:1 (<Instance-a> 65)
MSG >> init ED:1 (<Instance-a>)
MSG << init ED:1 (<Instance-a>)
[a]
CLIPS> (unwatch messages)
CLIPS>


next up previous