I think Andreas Rasmusson wrote:
>
> Hi!
>
> So, I noticed that in ReflectFunctions.java in valueToObject()
> the test if an atom correspnds to a java-null value is:
>
> else if (!clazz.isPrimitive() && s.equals("NIL"))
> return null;
>
> Whereas when the null-values are converted to atoms in
> Funcall.java as
>
> s_nil = new Value("nil",RU.ATOM);
>
This is an out and out bug. I'm readying a 4.3 release already, so a
fix will be in there. Actually, what I did was
else if (!clazz.isPrimitive() && s.equals(Funcall.NIL().stringValue()))
so that the string "nil" isn't duplicated and therefore can't be
mistyped again!
>
> One more thing. I am thinking about adding automatic conversion of atoms
> to java-strings
> at appropriate places.
This is something I've thought about occasionally; I generally put the
idea aside for two reasons: 1) there would need to be special-case
code in a lot of places, making Jess slower and fatter just to support
this syntactic convenience; and 2) it introduces new problems: what if
I want to call a method on a String? What if I want to call a method
on a Value? What if I want to call a method on a Value containing a
String? What if I want to pass a Value containing a java String? What
if I want to pass a java String to a Userfunction? Each of these would
require a specific policy choice, and I'm sure would surprise
somebody. The current system, in which this promotion is done in only
one circumstance ( (call "A String" hashCode) will evoke the hashCode
method of a Java String) is at least easy to explain. But I'm open to
alternate proposals, given that they include consideration of this
kind of issue.
---------------------------------------------------------
Ernest Friedman-Hill
Distributed Systems Research Phone: (925) 294-2154
Sandia National Labs FAX: (925) 294-2234
Org. 8920, MS 9214 [EMAIL PROTECTED]
PO Box 969 http://herzberg.ca.sandia.gov
Livermore, CA 94550
---------------------------------------------------------------------
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]
---------------------------------------------------------------------