Re: Re: KVO and the observeValueForKeyPath bottleneck
Re: Re: KVO and the observeValueForKeyPath bottleneck
- Subject: Re: Re: KVO and the observeValueForKeyPath bottleneck
- From: "Michael Ash" <email@hidden>
- Date: Mon, 17 Jul 2006 14:11:41 -0400
On 7/17/06, Matt Neuburg <email@hidden> wrote:
On or about 7/17/06 7:57 AM, thus spake "Jakob Olesen" <email@hidden>:
> Seriously, is there any reason for checking respondsToSelector?
> Wouldn't it be better to get an exception (or crash) if you mistype
> the selector or somebody else registers you as an observer?
No. That's not how notification (or, for that matter, delegation) behaves.
Both those behaviors are considered perfectly acceptable. m.
Delegation and notifications actually behave completely oppositely in
this respect. If you fail to implement a delegate method then nothing
happens except the object uses the default behavior. If you fail to
implement a notification method (one you explicitly signed up for, not
one that you get "for free" as part of being a delegate) then you get
a nice runtime exception when the notification is sent.
Since this case is much more analogous to notifications than
delegation, getting the exception is probably the right approach.
Mike
_______________________________________________
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