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 (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 [EMAIL PROTECTED]

Reply via email to