Following this a bit further, it seems that even:
(eq (new java.lang.StringBuffer "a") (new java.lang.StringBuffer "a"))
does not give the expected result. A quick look at the code in Value.java
suggests that it does use equals but I might be overlooking some details.
Bob.
Bob Johnson wrote:
> Fellow Jessians,
>
> I need to populate multislots with Java objects and subsequently
> perform multislot set comparisons. I was assuming that all
> comparisons on external addresses would be accomplished via the Java
> "public boolean equals(Object obj)" method. The following interaction
> seems to prove otherwise:
>
> ----------------------------------------------------------------------
> Jess, the Java Expert System Shell
> Jess Version 4.3 12/3/98
>
> Output appears in this window.
> Type your input in the one-line input box below.
> Jess> (defglobal ?*buffa* = (new java.lang.StringBuffer "a"))
> TRUE
> Jess> (defglobal ?*buffb* = (new java.lang.StringBuffer "b"))
> TRUE
> Jess> (subsetp (create$ ?*buffa*) (create$ ?*buffb*))
> TRUE
> Jess> (subsetp (create$ "a") (create$ "b"))
> FALSE
> Jess> (call ?*buffa* toString)
> "a"
> Jess> (call ?*buffb* toString)
> "b"
> Jess> (call ?*buffa* equals ?*buffb*)
> FALSE
> Jess>
> ----------------------------------------------------------------------
>
> Am I expecting something that I shouldn't or is this a bug?
>
> Regards,
>
> Bob
>
> ---------------------------------------------------------------------
> To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
> in the BODY of a message to [EMAIL PROTECTED], NOT to the
> list. 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. List problems? Notify [EMAIL PROTECTED]
---------------------------------------------------------------------