Re: NSDictionary valueForKey: and @ character at start of NSString
Re: NSDictionary valueForKey: and @ character at start of NSString
- Subject: Re: NSDictionary valueForKey: and @ character at start of NSString
- From: email@hidden
- Date: Tue, 15 May 2007 11:50:46 -0400
On May 15, 2007, at 10:45 AM, Joe Goh wrote:
Does anyone *know* why Apple has decided to add the extra
functionality to NSDictionary to handle strings with @ characters at
the start seperately? Is it for some internal Cocoa use or some
remnant from NeXT? Is my category method safe for production use?
You should really read the entire documentation on Key-Value Coding.
As Clark noted, your category on NSDictionary breaks all of the set
operators (they all begin with "@" ).
http://developer.apple.com/documentation/Cocoa/Conceptual/KeyValueCoding/index.html
I suggest you re-think your data model and not use arbitrary strings
as a key. In addition to the problem you have now with the @, if you
get a key that has a period in it, it will cause problems for any
calls to the AtKeyPath: methods. You may not see a need for them now,
but KVC is used throughout the frameworks, so you are limiting future
flexibility in accessing your data.
----
Aaron Burghardt
email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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