• 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: -[NSSet containsObject:] returns NO when it should return YES
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: -[NSSet containsObject:] returns NO when it should return YES


  • Subject: Re: -[NSSet containsObject:] returns NO when it should return YES
  • From: Ken Thomases <email@hidden>
  • Date: Sat, 19 Feb 2011 21:31:24 -0600

On Feb 19, 2011, at 9:26 PM, Quincey Morris wrote:

> On Feb 19, 2011, at 19:06, Kyle Sluder wrote:
>
>> Your experience indicates that -containsObject: uses pointer identity, whereas -member: uses -isEqual:.
>
> What's especially confusing is that -[NSArray containsObject:] is documented to use -isEqual. It seems like the NSSet method ought to be called -containsObjectIdenticalTo: for consistency (and now clarity) reasons.

I think Kyle was just mistaken about this, lead astray by Michael's claims.  Andy's experiment shows that -[NSSet containsObject:] relies on equality, not identity, just as one expects.  It's just that Michael has two truly non-equal NSNumber objects, as his gdb output showed.

Regards,
Ken

_______________________________________________

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

  • Follow-Ups:
    • Re: -[NSSet containsObject:] returns NO when it should return YES
      • From: Andy Lee <email@hidden>
References: 
 >-[NSSet containsObject:] returns NO when it should return YES (From: Michael Crawford <email@hidden>)
 >Re: -[NSSet containsObject:] returns NO when it should return YES (From: Ken Thomases <email@hidden>)
 >Re: -[NSSet containsObject:] returns NO when it should return YES (From: Michael Crawford <email@hidden>)
 >Re: -[NSSet containsObject:] returns NO when it should return YES (From: Kyle Sluder <email@hidden>)
 >Re: -[NSSet containsObject:] returns NO when it should return YES (From: Quincey Morris <email@hidden>)

  • Prev by Date: Re: -[NSSet containsObject:] returns NO when it should return YES
  • Next by Date: Re: Multithread, Window, Event, Runloop, ... => Headache
  • Previous by thread: Re: -[NSSet containsObject:] returns NO when it should return YES
  • Next by thread: Re: -[NSSet containsObject:] returns NO when it should return YES
  • Index(es):
    • Date
    • Thread