2014-12-30 17:14 GMT+01:00 phil@highoctane.be <phil@highoctane.be>:


Le 30 d��c. 2014 13:13, "Cl��ment Bera" <bera.clement@gmail.com> a ��crit :
>
> Hello Pharoers,
>
> I was wondering, is it a good practice to have negative hashes ?
>
> Based on the class comment of Object>>#hash
>
> "Answer a SmallInteger whose value is related to the receiver's identity. [...]"
>
> The hash is a smallInteger and therefore can be negative.

Why would this be a poor practice if seen as a set of bits?

As long as it does its job for identifying buckets, it looks okay to me.

More bits with good spreading is more space for the hashes.

Now hash should be redefined along with equals if we run into large sets to limit collisions. And I guess we wouldn't keep SmallInteger then.

Why the question?


Well I am fixing compiled method to support negative compiled method header and the compiled method hash may now be negative if its compiled method header is. That's why.


Phil

>
> Thanks for any answer.
>
> Clement