On Jan 17, 2010, at 11:15 AM, Jeffrey Oleander wrote:

>> On Sat, 2010/01/16, Ken Thomases <k...@codeweavers.com> wrote:
>>> On 2010 Jan 14, at 17:11, Carter R. Harrison wrote:
>>> My model is an NSMutableSet that contains
>>> NSMutableDictionaries.
>> 
>> I think this is asking for trouble.  A set of mutable
>> dictionaries doesn't make much sense.
>> 
>> ..."Equal" is determined by the -isEqual: and -hash
>> methods, not by identity (memory location).
> 
> So, it's quite possible that he has a "hash" used by
> the NSMutableSet which doesn't depend on the contents 
> of the mutable dictionary once it's been created.

Huh?  The hash in question is that of the mutable dictionaries.  He doesn't get 
to decide this.  It's a near certainty that the hash of a dictionary is 
sensitive to its contents.  First, logically, how else would the NSDictionary 
implement equality?  Second, the documentation I cited virtually asserted that 
it's so.

So, if you mutate a dictionary while it's inside a collection, that will cause 
trouble.  The documentation I cited says this, too, without equivocation.

He also doesn't get to decide on the hash of the set, if that's what you were 
thinking about.

He could implement some custom class and decide how its hash is implemented, 
but that's beside the point I was making.  In fact, that was one of my 
suggested solutions.

In other words, I'm not sure what you're trying to say.

Regards,
Ken

_______________________________________________

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