• 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 12:01:23 +0200

Le 6 oct. 04, à 01:59, Max Barel a écrit :

Le 6 oct. 04, à 00:10, mmalcolm crawford a écrit :

On Oct 5, 2004, at 3:02 PM, Max Barel wrote:
Le 5 oct. 04, à 23:55, xx a écrit :
On Oct 5, 2004, at 2:29 PM, Max Barel wrote:
The valueForKey: method is defined in the NSKeyValueCoding protocol of NSObject. It is also overloaded in NSDictionary.
Is the NSDictionary version of the method conforming to the NSKeyValueCoding?
The documentation is explicit about exactly what NSDictionary's valueForKey: method does:
"Returns the result of sending objectForKey: to the receiver."
Yes, I saw. That's why I suggested that it is NOT KCV compliant since it does not conform to the first rule of the KVC method of the same name.

I'm not sure what the problem is?

Looks like I did not clearly expressed my thought.

If KVC compliant, the NSDictionary class would allow to access information of instances, like the count of object inside, trough the -count method/property, or the description of its content, trough the -descriptionInStringsFileFormat (we forget about -description which has a known flaw).

It does not since the -valueForKey: method is overloaded to be a synonym for -objectForKey:. This method only return objects inside the dictionary, ignoring other valid accessor cases mentioned above.

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.
- Document the specificity of NSDictionary and the @count operator availability.
_______________________________________________
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
  • Follow-Ups:
    • 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: Christian Brunschen <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>)

  • Prev by Date: Translating UTF8 range into NSString range?
  • Next by Date: Re: [OT] help please, trying to find Louis Sacha
  • 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