Re: copy & isEqual nightmares
Re: copy & isEqual nightmares
- Subject: Re: copy & isEqual nightmares
- From: Quincey Morris <email@hidden>
- Date: Thu, 16 Feb 2012 13:47:19 -0800
On Feb 16, 2012, at 11:44 , Ken Thomases wrote:
> Well, the documentation for -[NSDictionary isEqualToDictionary:] <https://developer.apple.com/library/ios/DOCUMENTATION/Cocoa/Reference/Foundation/Classes/NSDictionary_Class/Reference/Reference.html#//apple_ref/occ/instm/NSDictionary/isEqualToDictionary:> says:
>
> "Returns a Boolean value that indicates whether the contents of the receiving dictionary are equal to the contents of another given dictionary."
>
> And:
>
> "Two dictionaries have equal contents if they each hold the same number of entries and, for a given key, the corresponding value objects in each dictionary satisfy the isEqual: test."
That's what I meant by a hint. We *assume* that by design -[NSDictionary isEqual:] invokes -[NSDictionary isEqualToDictionary:], perhaps with a check on the class of the parameter first.
The other hint I found was in the NSObject protocol for 'isEqual:':
<https://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Protocols/NSObject_Protocol/Reference/NSObject.html>
"This method defines what it means for instances to be equal. For example, a container object might define two containers as equal if their corresponding objects all respond YES to an isEqual: request. See the NSData,NSDictionary, NSArray, and NSString class specifications for examples of the use of this method."
Note that it says "might". Also, the only examples of using 'isEqual' I could find in the NSDictionary class reference are discussions of equal keys, not equal dictionaries.
Either way, I don't see an API contract.
_______________________________________________
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