Ernest,

I'll probably be the first of many to 
point out the obvious fact that no
matter what you decide, it won't please
everybody.  ;)

Having said that, from an interface encapsulation and robustness
point of view, I would want to see the Wrapper object,
not the primitive type.

In my experience with development, interfaces/boundaries 
that return primitive types have a nasty habit of causing
rippling effects if either the interface changes, or the underlying
machine representation/constraints of the primitive change.
(Like depending on the Date or String type characteristics gotten from a
database,
but now you change underlying databases, for example.)

So, I vote for the Wrapper object.

---------------
George Rudolph
Mad Scientist
Motorola ISD
---------------


<*>-----Original Message-----
<*>From: [EMAIL PROTECTED]
<*>[mailto:[EMAIL PROTECTED]]
<*>Sent: Thursday, October 19, 2000 12:04 PM
<*>To: Lucero, Michael
<*>Cc: '[EMAIL PROTECTED]'
<*>Subject: Re: JESS: Java to Jess type conversion
<*>
<*>
<*>Hi Michael,
<*>
<*>I can confirm this behaviour in Jess 6, too.  It's actually not just
<*>field access, but method return values too -- i.e., the return value
<*>of a method returning Integer would be similarly converted.
<*>
<*>It is arguably incorrect for this conversion to be done at all; I'm
<*>not sure what I was thinking when I defined it this way. I 
<*>believe the
<*>current behaviour was influenced by user comments on the behviour of
<*>Java Strings. Several people expressed the opinion that a method
<*>returning String should return a Jess string when called from Jess,
<*>not an external address with a Java String in it.
<*>
<*>Let me throw this one out for comment. If you call a method 
<*>or fetch a
<*>field of type Integer (or Float, or Double, or Boolean) should it
<*>return the primitive type in Jess, as it does now, or should 
<*>it return
<*>the wrapper object? What do people think?
<*>
<*>
<*>I think Lucero, Michael wrote:
<*>[Charset iso-8859-1 unsupported, filtering to ASCII...]
<*>> Using Jess 5.1:
<*>> 
<*>> if I have a class like this:
<*>> 
<*>> public class A
<*>> {
<*>>    public final static Object VAR = new Integer(1);
<*>> 
<*>>    public void setValueById(Object id)
<*>>    {
<*>>            m_val = id;
<*>>             }
<*>> 
<*>>    private Object m_val,
<*>> }
<*>> 
<*>> and rules (forgive syntax errors):
<*>> 
<*>> (defclass classA A)
<*>> 
<*>> (defRule varTest
<*>>    (classA (OBJECT ?o))
<*>> =>
<*>>    (call ?o setValueById (get-member A VAR))
<*>> )
<*>> 
<*>> I get an exception when the rule fires:
<*>>   Message: No overloading of method 'setValueById' in 
<*>class A I can call
<*>> with these arguments: (call ?o setValueById (get-member A VAR)).
<*>> 
<*>> I think the problem here is that 'get-member' does not 
<*>return an external
<*>> address, but has translated it to a Jess Integer type.
<*>> 
<*>> Is this expected, and, if so, is there a way to prevent 
<*>that automatic
<*>> translation.
<*>> 
<*>> Thanks in advance
<*>> 
<*>> Michael Lucero
<*>> 
<*>---------------------------------------------------------------------
<*>> 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]
<*>> 
<*>---------------------------------------------------------------------
<*>> 
<*>
<*>
<*>
<*>---------------------------------------------------------
<*>Ernest Friedman-Hill  
<*>Distributed Systems Research        Phone: (925) 294-2154
<*>Sandia National Labs                FAX:   (925) 294-2234
<*>Org. 8920, MS 9012                  [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 (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