As usual, you're right on the mark. I was trying to deal with code written by someone else, and it was a little broken. Programmer error. Sorry for the noise.

--
Richard Kasperowski
Tel: 617-576-1552, Fax: 617-576-2441
mailto:[EMAIL PROTECTED]
http://www.altisimo.com/



[EMAIL PROTECTED] wrote:
Hi Richard,
(retract foo) gives a ClassCastException because "foo" is a symbol,
not a fact. Similarly, (retract (foo)) gives an "Unimplemented
function foo." Both of these are coding errors, and exceptions are
how Jess reports them.

The following code

Jess> (clear)
TRUE
Jess> (bind ?f (new jess.Fact foo (engine)))
<External-Address:jess.Fact>
Jess> (retract ?f)
TRUE

shows that retracting an unasserted fact does, indeed, fail
silently. Alternatively, there's "retract-string," which behaves the
same way, except that the argument is a string which gets parsed into
a fact:

Jess> (retract-string "(foo)")
TRUE


I think Richard Kasperowski wrote:

If fact foo hasn't been asserted yet, then (retract foo) bars with ClassCastException. Sure, retracted something that hasn't been asserted is bad behavior on my part, but shouldn't retract behave better, too? Is ClassCastException the expected behavior, or should it silently fail instead?




---------------------------------------------------------
Ernest Friedman-Hill Distributed Systems Research Phone: (925) 294-2154
Sandia National Labs FAX: (925) 294-2234
PO Box 969, MS 9012 [EMAIL PROTECTED]
Livermore, CA 94550 http://herzberg.ca.sandia.gov

--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the list
(use your own address!) List problems? Notify [EMAIL PROTECTED]
--------------------------------------------------------------------



--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the list
(use your own address!) List problems? Notify [EMAIL PROTECTED]
--------------------------------------------------------------------

Reply via email to