• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Differences between -isEqual: and -isEqualTo:?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Differences between -isEqual: and -isEqualTo:? (From: Rick Mann <email@hidden>)
 >Re: Differences between -isEqual: and -isEqualTo:? (From: Dave DeLong <email@hidden>)
 >Re: Differences between -isEqual: and -isEqualTo:? (From: Charles Srstka <email@hidden>)
 >Re: Differences between -isEqual: and -isEqualTo:? (From: Ken Thomases <email@hidden>)
 >Re: Differences between -isEqual: and -isEqualTo:? (From: Keith Duncan <email@hidden>)
 >Re: Differences between -isEqual: and -isEqualTo:? (From: "Shawn Erickson" <email@hidden>)
 >Re: Differences between -isEqual: and -isEqualTo:? (From: Jim Correia <email@hidden>)
 >Re: Differences between -isEqual: and -isEqualTo:? (From: Keith Duncan <email@hidden>)
 >Re: Differences between -isEqual: and -isEqualTo:? (From: Ken Thomases <email@hidden>)
 >Re: Differences between -isEqual: and -isEqualTo:? (From: Keith Duncan <email@hidden>)
 >Re: Differences between -isEqual: and -isEqualTo:? (From: Jim Correia <email@hidden>)

  • Prev by Date: Re: Drawing an NSImage in a CALayer
  • Next by Date: File I/O
  • Previous by thread: Re: Differences between -isEqual: and -isEqualTo:?
  • Next by thread: Re: Differences between -isEqual: and -isEqualTo:?
  • Index(es):
    • Date
    • Thread