About Hash code

CGableWatts at Mac.com CGableWatts at Mac.com
Mon May 13 17:23:32 UTC 2002


It is a common misconception that an identityhash is supposed to be unique.  A hash value, by defininition, can return the same value for two different objects. See ProtoObject>>identityHash.  A hash value, by definition, only guarantees that each object will alway answer the SAME hash value for itself AND that different objects USUALLY have different hash values

Does ((Module @ #(People Ab)) parentModule) == ((Module @ #(People Ab)) veryDeepCopy parentModule)? If so then they have the same identityHash because they ARE the same object.  It is a common misconception that deepCopies MUST have all new objects in them.  Some Objects, like Symbol, can refuse to make copies of themselves and answer ^self when asked for a copy. 

Bergel Alexandre wrote on 8/5/02 4:26 pm:

Anyone knows why : 
((Module @ #(People Ab)) parentModule identityHash) = ((Module @ #(People Ab)) veryDeepCopy parentModule identityHash)
return true ?



More information about the Squeak-dev mailing list