I still think leaving identityHash alone and using scaledIdentityHash to
multiply by 2^18 is better for backwards compatibility. However, I do
not know how much of a problem changing identityHash will cause for
existing code. Something that has always bugged me about changing
identityHash is that (as far as I've seen) identityHash is typically
assumed to answer whatever bits are in the object header. I am not sure
introducing an exception in Pharo, or even changing the assumption that
has held for decades, is worth the benefit of changing identityHash.
On 6/2/10 0:44 , Stéphane Ducasse wrote:
Hi!
Apparently in Pharo 1.1, hash values may be greater than 4096. What is the
range of the hash values?
Cheers,
Alexandre
_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Hash values could always be greater than 4096 :)
Identity hashes can't, but they are scaled in 1.1, to avoid bad clustering
That's not true. You may be surprised, but the value of #identityHash can be
any SmallInteger. Just try this:
{SmallInteger minVal. SmallInteger maxVal} collect: #identityHash.
Yeah, forgot about that one.
for objects not redefining hash.
Basically they're multiplied by 2^18, which gives the largest possible range
while still keeping all small integers.
See ProtoObject>>identityHash for details, old identityHash is now
basicIdentityHash.
This may cause compatibility problems for packages which implement custom
hashes or custom hashed collections. I think Magma will be affected by this,
though I didn't check the code.
Not sure why it ended up basicIdentity / identity instead of identity /
scaledIdentity, but that's true.
so what should we do in 1.2?
Stef
_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project