Re: Differences between -isEqual: and -isEqualTo:?
Re: Differences between -isEqual: and -isEqualTo:?
- Subject: Re: Differences between -isEqual: and -isEqualTo:?
- From: Nate Weaver <email@hidden>
- Date: Fri, 19 Sep 2008 16:08:54 -0500
This is the gist of it, I think. NSArray and NSDictionary should be
safe to store mutable objects, since they use an index or a key for
storage position, and not the object (the value) itself.
So (as I understand it): You *are* allowed to mutate objects in
collections, but only if the object state doesn't determine storage
position in the collection (NSArray/NSDictionary yes, NSSet no), or
you can be sure the object's hash will not change (it probably will).
(I may be repeating what's been said, but maybe it'll be a bit more
clear?)
On Sep 19, 2008, at 9:14 AM, Jim Correia wrote:
On Sep 19, 2008, at 6:32 AM, Keith Duncan wrote:
If this is so fundamental, why haven't I been tripped up by it?
It is an edge case, but one worth knowing about. You have to be
storing mutable objects in a collection whose internal storage
position depends on the objects hash code.
Jim
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden