Code: Select all
:class MyClass
:field private MyValue
{del}MyClass x
:implements constuctor
:access public
MyValue<-x
{del}
:endclass
and the following objects:
Code: Select all
x<-[]new MyClass 5
y<-[]new MyClass 5
xx<-x
My initial expectation was that x{match}y should return a 1, but it returns a zero because the references are different although the value (object) pointed to by the reference is identical. Only x{match}xx returns a 1.
If I define the following variables:
Code: Select all
x<-5 'Hello' (3 3{rho}{iota} 9)
y<-5 'Hello' (3 3{rho}{iota} 9)
x{match}y returns of course a 1, even though x and y point to different arrays in memory. It would seem to me that applying {match} to the actual object as opposed to the pointers to the object would be an order of magnitude more useful and a lot more consistent with the way match has always worked. Even C++ allows for a member by member comparison simply by using = on the references to objects.
Other than writing your own member function in every class or a "weird" function that does an execute on namelist of all fields/vars in the object (yuck!) - is there an easy way to check for the equivalence of two objects?
Thanks for any input!