I don't think it is possible to invoke an instance method when using an object-pattern-CE
Can you tell me how CLIPS shoul be modified in order to add the functionality below:
(defrule R (object (is-a A) (test (send ?self <handler> <args>*))) =>)
A possible workaround valid in a not-CE:
(defclass A (is-a USER)
(slot value)
(slot me)
)
(defmessage-handler A init ()
(bind ?self:me ?self)
)
(defmessage-handler A check (?arg)
(printout t "check " (instance-name ?self) crlf)
)
(defrule checkobject
(not
(object (is-a A) (value ?val) (me ?ins))
(test (send ?me check ?val))
)
=>
)
Thanks
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I don't think it is possible to invoke an instance method when using an object-pattern-CE
Can you tell me how CLIPS shoul be modified in order to add the functionality below:
(defrule R (object (is-a A) (test (send ?self <handler> <args>*))) =>)
A possible workaround valid in a not-CE:
(defclass A (is-a USER)
(slot value)
(slot me)
)
(defmessage-handler A init ()
(bind ?self:me ?self)
)
(defmessage-handler A check (?arg)
(printout t "check " (instance-name ?self) crlf)
)
(defrule checkobject
(not
(object (is-a A) (value ?val) (me ?ins))
(test (send ?me check ?val))
)
=>
)
Thanks
Here are 3 ways to do it: