Re: -[NSSet containsObject:] returns NO when it should return YES
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