> On Fri, 2009/08/21, Quincey Morris <quinceymor...@earthlink.net> wrote:
> From: Quincey Morris <quinceymor...@earthlink.net>
> Subject: Re: When do I need to override hash?
> To: "cocoa-dev" <cocoa-dev@lists.apple.com>
> Date: Friday, 2009 August 21, 00:48
>> On 2009 Aug 20, at 22:05, Jeff Laing wrote:
>> Without wanting to keep the thread going forever,
>> can I just ask why we would presume this?
>>
>> In fact, if I were implementing NSDictionary
>> I'd assume the reverse, that I was not allowed
>> to assume that an objects hash would not change..

>>>>> "If a mutable object is added to a collection
>>>>> that uses hash values to determine the
>>>>> object’s position in the collection, the
>>>>> value returned by the hash method of the
>>>>> object must not change while the object
>>>>> is in the collection."

The impression I get from all this is that

* if you do want to change how you hash,
 you should pull objects out of the collections
 with the old hash and then add them back in
 using the new hash.

* be careful when choosing a hash scheme; it
 has to be fast and it has to produce keys
 that minimize collisions and yet come out
 the same when you want it to come out the
 same.



_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to