Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.
Using COOL, I try to define a rule, with the condition that no value has been set to a slot.
Here is what I tried :
(make-instance [a] of MyClass)
(make-instance [b] of MyClass (LinkedTo [a]))
?obj <- (object (is-a MyClass) (LinkedTo nil))
(printout t (instance-name ?obj) crlf)
But I get the following error :
[CSTRNCHK1] A literal restriction value found in CE #1 does not match the allowed types for slot LinkedTo.
Can somebody help me ?
The defaulted value for a slot restricted to type INSTANCE or INSTANCE-NAME is the instance name [nil], not the symbol nil. You get an error using the value nil in the LinkedTo slot because symbol is not a valid type for that slot. If you replace nil with [nil], the rule will not generate an error:
?obj <- (object (is-a MyClass) (LinkedTo [nil]))
(printout t (instance-name ?obj) crlf))
Thank you Gary.
It works well indeed.