List Info

Thread: Re: (no subject)




Re: (no subject)
user name
2007-01-16 16:35:53
At 09:01 AM 1/15/2007 +0100, Paolo Bonzini wrote:
>>If the value of
>>       receiver == comparand
>>    is true then the receiver and comparand must
have equivalent
>>    identity hash values. Or more formally:
>>       receiver == comparand ==>
>>          receiver identityHash = comparand
identityHash
>
>This is not an "if and only if".  If two
objects have the same 
>identityHash you cannot conclude that they are
identical.  In GNU 
>Smalltalk "x identityHash identityHash == x
identityHash" in particular, 
>so every object's identityHash will collide with exactly
one integer's 
>identityHash.

This was the question that I needed an answer for. I saw
that the spec in 
the ANSI document and it didn't match the behavior
exhibited. Nor did it 
match the behavior in Squeak or VW either. I figured that
something else 
must be used to distinguish objects because primitives are
used instead of 
just a comparison of identityHashes.


>Also note that "51546 asOop" is an error,
while "51546 identityHash" is 
>the integer 51546 itself.
>
>In the other case, (123/3) is the integer 41 rather than
the fraction 
>(41/1), so
>
>   123 / 3 identityHash = 123 / (3 identityHash) = 123 /
3 = 41
>   (123 / 3) identityHash = 41 identityHash = 41
>   (123 / 3) asFraction identityHash = (41/1)
identityHash = an object index
>                                       ^^^^^^
>            this represents a Fraction object, not the
value of 41/1
>
>Paolo



_______________________________________________
help-smalltalk mailing list
help-smalltalkgnu.org

http://lists.gnu.org/mailman/listinfo/help-smalltalk

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )