2014-12-30 18:53 GMT+01:00 Clément Bera <[email protected]>:

>
>
> 2014-12-30 17:14 GMT+01:00 [email protected] <[email protected]>:
>
>>
>> Le 30 déc. 2014 13:13, "Clément Bera" <[email protected]> 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.
>
>
>
But -1 hash -> -1 already, so I don't see any problem...

Nicolas

> Phil
>>
>> >
>> > Thanks for any answer.
>> >
>> > Clement
>>
>
>

Reply via email to