• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Binding/KVC : valueForKey: and NSDictionary (was: valid accessor for framework objects. (was: implicit and explicit invocation of description method))
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Binding/KVC : valueForKey: and NSDictionary (was: valid accessor for framework objects. (was: implicit and explicit invocation of description method))


  • Subject: Re: Binding/KVC : valueForKey: and NSDictionary (was: valid accessor for framework objects. (was: implicit and explicit invocation of description method))
  • From: Max Barel <email@hidden>
  • Date: Wed, 6 Oct 2004 15:53:14 +0200


Le 6 oct. 04, à 15:13, Christian Brunschen a écrit :

On 6 Oct 2004, at 11:01, Max Barel wrote:

Self followup, for the record:

A private mail reply suggested that the @count array operator might work for NSDictionary. IT DOES.

I filled an enhancement request about this. Excerpt:

Ehancement request:
- Modify the -valueForKey: of NSDictionary for it to call -objectForKey: and if the return value is nil, then resort to the default -valueForKey: behavior.

...snip...

I believe that NSDictionary's current behaviour, where the contents of the dictionary not just override but completely replace what the default implementation would do, is correct.

You have noted, of course, that keys beginning with '@' are used to specify 'operators' on NSArrays and on NSDictionaries. These offer a way to 'talk to' the NSDictionary itself (rather than its contents) using key-value coding. However, for NSDictionary at least, these are not sufficiently documented, and thus, your second suggestion,

- Document the specificity of NSDictionary and the @count operator availability.

is of course excellent.

One might consider if an operator '@self', which would give access to the dictionary (or array) using the default KVC implementation, might be useful: Thus, rather than having to specify sn explicit '@count' operator, one could use the key-path '@self.count' - and that would work for any method(s) that might be added to arrays, dictionaries, or other collection classes. Hmmm...

I agree with your objection and subscribe to the @self suggestion, simple and efficient.
Do you think I should update the enhancement request?

BTW, I tried the @self operator since I read in this thread that it is implemented (undocumented) for other objects BUT the NSDictionnary:
http://www.cocoabuilder.com/archive/message/cocoa/2004/9/1/116288

As stated it doesn't work, but there is probably not much modification needed to the controller layer to make it a general operator. Nevertheless the specific behavior of NSDictionnary should be pointed, as it is for the NSArray, because it breaks the rule and complicate the learning process when randomly encountered.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden
References: 
 >Binding/KVC : implicit and explicit invocation of description method (From: Max Barel <email@hidden>)
 >Re: Binding/KVC : implicit and explicit invocation of description method (From: Scott Anguish <email@hidden>)
 >Re: Binding/KVC : valid accessor for framework objects. (was: implicit and explicit invocation of description method) (From: Max Barel <email@hidden>)
 >Re: Binding/KVC : valid accessor for framework objects. (was: implicit and explicit invocation of description method) (From: Scott Anguish <email@hidden>)
 >Re: Binding/KVC : valid accessor for framework objects. (was: implicit and explicit invocation of description method) (From: Max Barel <email@hidden>)
 >Re: Binding/KVC : valueForKey: and NSDictionary (was: valid accessor for framework objects. (was: implicit and explicit invocation of description method)) (From: Max Barel <email@hidden>)
 >Re: Binding/KVC : valueForKey: and NSDictionary (was: valid accessor for framework objects. (was: implicit and explicit invocation of description method)) (From: mmalcolm crawford <email@hidden>)
 >Re: Binding/KVC : valueForKey: and NSDictionary (was: valid accessor for framework objects. (was: implicit and explicit invocation of description method)) (From: Max Barel <email@hidden>)
 >Re: Binding/KVC : valueForKey: and NSDictionary (was: valid accessor for framework objects. (was: implicit and explicit invocation of description method)) (From: Max Barel <email@hidden>)
 >Re: Binding/KVC : valueForKey: and NSDictionary (was: valid accessor for framework objects. (was: implicit and explicit invocation of description method)) (From: Christian Brunschen <email@hidden>)

  • Prev by Date: Re: adding menu items and making them work [Java]
  • Next by Date: Re: FOUND Workaround Re: Disk Utility....
  • Previous by thread: Re: Binding/KVC : valueForKey: and NSDictionary (was: valid accessor for framework objects. (was: implicit and explicit invocation of description method))
  • Next by thread: Re: Binding/KVC : valueForKey: and NSDictionary (was: valid accessor for framework objects. (was: implicit and explicit invocation of description method))
  • Index(es):
    • Date
    • Thread