Actions
Bug #6008
closed{a: 1}.hash not consistent over VM restarts
Description
$ ruby -e 'puts ({a: 1}.hash)'
-2419336229553239378
$ ruby -e 'puts ({a: 1}.hash)'
-4506930541181251952
$ ruby -e 'puts ({a: 1}.hash)'
2108665473238231010
$ ruby -e 'puts ({a: 1}.hash)'
-3675793335936991568
But if you go to rvm 1.8.7
ruby -e 'puts ({:a => 1}.hash)'
425023
ruby -e 'puts ({:a => 1}.hash)'
425023
ruby -e 'puts ({:a => 1}.hash)'
425023
The documentation read:
Generates a Fixnum hash value for this object. This function must have the property that a.eql?(b) implies a.hash == b.hash. The hash value is used by class Hash. Any hash value that exceeds the capacity of a Fixnum will be truncated before > being used.
Which implies that you should get the behaviour in 1.8.7.
Regards,
Jens
Actions
Like0
Like0Like0Like0Like0Like0