Op 8 okt 2010, om 20:34 heeft Quincey Morris het volgende geschreven:

On Oct 8, 2010, at 04:47, Remco Poelstra wrote:

Is there a reason valueForKey: is documented directly but valueForKeyPath: is not?

They're both documented, but it requires familiarity with how to read the Cocoa documentation, which is an important point that goes beyond just this example.

The methods are documented as part of the NSKeyValueCoding protocol here:

http://developer.apple.com/library/mac/#documentation/Cocoa/ Reference/Foundation/Protocols/NSKeyValueCoding_Protocol/Reference/ Reference.html

It's briefly mentioned, in that document and slightly more definitively in:

http://developer.apple.com/library/mac/#documentation/Cocoa/ Conceptual/KeyValueCoding/Concepts/Overview.html

that there's a default implementation of NSKeyValueCoding in NSObject. NSDictionary inherits this behavior from NSObject, but because the default 'valueForKeyPath:' is documented as operating in terms of 'valueForKey:', NSDictionary only needs to override the latter, and its own documentation only needs to document the override.

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.

Kind regards,

Remco Poelstra
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to