[squeak-dev] true hash
David T. Lewis
lewis at mail.msen.com
Thu May 10 12:14:43 UTC 2012
On Thu, May 10, 2012 at 12:41:13PM +0200, Bert Freudenberg wrote:
>
> On 10.05.2012, at 01:40, Chris Muller wrote:
>
> >> How do these clients suddenly
> >> acquire new hashes for nil, true and false?
> >
> > I should add, it's already happened. In 2009 Levente changed
> > Object>>#identityHash to answer the scaledIdentityHash.
>
> Not in Squeak. Our IdentityDictionary uses scaledIdentityHash nowadays, but identityHash itself is left alone, answering the primitive value directly.
>
> You may be thinking of Pharo, where you now need to use basicIdentityHash to get the primitive hash, and identityHash answers the more useful scaled value. Be aware though that Pharo also manipulates SmallInteger hashes where Squeak doesn't (yet, anyway).
>
> Did I mention it's a bad idea to depend on actual hash values? ;)
>
> - Bert -
Squeak:
nil identityHash ==> 3840
true identityHash ==> 2950
false identityHash ==> 3152
Pharo:
nil identityHash ==> 1006632960
true identityHash ==> 773324800
false identityHash ==> 826277888
nil basicIdentityHash ==> 3840
true basicIdentityHash ==> 2950
false basicIdentityHash ==> 3152
More information about the Squeak-dev
mailing list
|