Re: Problem using dictionary
Re: Problem using dictionary
- Subject: Re: Problem using dictionary
- From: Abhi Beckert <email@hidden>
- Date: Tue, 19 Oct 2010 13:52:02 +1000
On 2010-10-09, at 6:14 AM, Remco Poelstra wrote:
> That seems reasonable, but makes the documentation harder to read. In the old days where I used Delphi, the inherited methods were all shown as such and it gives a direct overview of what is available. Especially in this case, where the valueForKey* methods are neither mentioned in the NSObject docs, not that NSObject followsNSKeyValueCoding. Well, maybe Apple adds such functionality someday to their doc browser.
[NSObject valueForKey:] has nothing to do with dictionaries. It's an internal API feature that's used throughout the framework. The foo.bar syntax is essentially an alias for [foo valueForKey:@"bar"]. Understanding exactly how this method works is one of the first things you need to learn as a cocoa programmer. NSDictionary wouldn't even document valueForKey: at all, except that it changes the behaviour slightly.
You can't document every message NSDictionary will respond to, most have nothing to do with dictionaries. Eg. would you expect +alloc to be documented? What about -performSelectorOnMainThread:withObject:waitUntilDone:? Both can be used on an NSDictionary, and neither are mentioned in the documentation.
You just need to get used to looking up parent classes and categories. Similarly, NSMutableDictionary doesn't document valueForKey: or count, even though those are probably the most important two methods in an NSMutableDictionary object. They are implemented in a parent class, and won't me listed in the NSMutableDictionary class reference.
The NSDictionary Class Reference is exactly that — a reference. If you want an introduction of how to use it, you must read "Collections Programming Topics", which is linked in the sidebar of NSDictionary's reference page.
- Abhi
_______________________________________________
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