help-smalltalk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-smalltalk] (no subject)


From: J Pfersich
Subject: [Help-smalltalk] (no subject)
Date: Mon, 15 Jan 2007 00:48:09 -0700

The ansi spec says:
5.3.1.2 Message: == comparand
Synopsis
   Object identity test.
Definition: <Object>
   This message tests whether the receiver and the comparand are the
   same object. Return true if the receiver is the same object as
   comparand. Otherwise return false.
   The value of
      receiver == comparand
   is true if and only if the value of
      comparand == receiver
   would also be true. 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

st> var3:= 'string' !
'string'
st> var3  hash !
227738570
st> var3  identityHash !
51546
I noticed that asOop uses the same primitive as identityHash:
st> var3 asOop !
51546
st> 51546 identityHash !
51546
st> 51546 = var3 identityHash !
true
st> 51546 identityHash = var3 identityHash !
true
but:
st> 51546 == var3 !
false
Can someone clear up the confusion?





reply via email to

[Prev in Thread] Current Thread [Next in Thread]