• 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: Bindings clarification: +setKeys:triggerChangeNotificationsForDependentKey: doesn't affect subclasses?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bindings clarification: +setKeys:triggerChangeNotificationsForDependentKey: doesn't affect subclasses?


  • Subject: Re: Bindings clarification: +setKeys:triggerChangeNotificationsForDependentKey: doesn't affect subclasses?
  • From: Jim Hamilton <email@hidden>
  • Date: Fri, 29 Jul 2005 09:02:55 -0400


On Jul 29, 2005, at 7:36 AM, Jim Correia wrote:

On Jul 28, 2005, at 7:13 PM, Jim Hamilton wrote:

Here's the answer:

<http://developer.apple.com/documentation/Cocoa/Reference/ Foundation/ObjC_classic/Classes/NSObject.html#//apple_ref/doc/uid/ 20000050-initialize>


Except it isn't.

OK, so I was rather terse...sorry. I gave the answer to "What's the right thing?", as opposed to "What do you do about the bug?"



The runtime docs also say that an initialize method shouldn't call super initialize.


<http://developer.apple.com/documentation/Cocoa/Conceptual/ ObjectiveC/LanguageOverview/chapter_3_section_4.html#//apple_ref/ doc/uid/20001424-87244>

Note: Remember that the runtime system sends initialize to each class
individually. Therefore, in a class’s implementation of the initialize
method, you must not send the initialize message to its superclass.


Given that, the documentation example which shows registration of dependent keys in the initialize method and my example from earlier today [1] the challenge is to implement an initialize on Person that registers the dependent key, and an implementation of [Employee initialize] which does not (because it does not, nor should it know, the inner workings of Person) register the dependent keys itself, or call [super initialize] in violation of the docs above.

[1] http://lists.apple.com/archives/cocoa-dev/2005/Jul/msg02292.html

It's true that Employee shouldn't know anything about Person, beyond the @protected interface. It's perfectly valid for Employee to know that it IS a Person, and it might be appropriate to know things about Person that aren't public.


As Pontus says, you can work around the bug in KVO (to give my opinion on your original question!) by exposing something in Person.

Jim H
--
Jim Hamilton

email@hidden
email@hidden

_______________________________________________
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: 
 >Bindings clarification: +setKeys:triggerChangeNotificationsForDependentKey: doesn't affect subclasses? (From: Jim Correia <email@hidden>)
 >Re: Bindings clarification: +setKeys:triggerChangeNotificationsForDependentKey: doesn't affect subclasses? (From: SA Dev <email@hidden>)
 >Re: Bindings clarification: +setKeys:triggerChangeNotificationsForDependentKey: doesn't affect subclasses? (From: Jim Correia <email@hidden>)
 >Re: Bindings clarification: +setKeys:triggerChangeNotificationsForDependentKey: doesn't affect subclasses? (From: SA Dev <email@hidden>)
 >Re: Bindings clarification: +setKeys:triggerChangeNotificationsForDependentKey: doesn't affect subclasses? (From: SA Dev <email@hidden>)
 >Re: Bindings clarification: +setKeys:triggerChangeNotificationsForDependentKey: doesn't affect subclasses? (From: Jim Hamilton <email@hidden>)
 >Re: Bindings clarification: +setKeys:triggerChangeNotificationsForDependentKey: doesn't affect subclasses? (From: Jim Correia <email@hidden>)

  • Prev by Date: Re: Bindings clarification: +setKeys:triggerChangeNotificationsForDependentKey: doesn't affect subclasses?
  • Next by Date: Re: binding with tranformer question
  • Previous by thread: Re: Bindings clarification: +setKeys:triggerChangeNotificationsForDependentKey: doesn't affect subclasses?
  • Next by thread: Formatters in IB
  • Index(es):
    • Date
    • Thread