Re: KVO, design and documentaion
Re: KVO, design and documentaion
- Subject: Re: KVO, design and documentaion
- From: patrick machielse <email@hidden>
- Date: Mon, 29 Jan 2007 15:29:05 +0100
"The Karl Adam" wrote:
Interesting discussion, I hadn't turned that up during my search for
information. The callback design is a bit Javaesque...
Since Java's design is based partially in ObjC and Cocoa, that's not
at all surprising.
I have no issue with Java copying Cocoa, but I'm not sure I like it
the other way around ;-)
You could be registering multiple times with
different contexts and different notification options, how is the API
supposed to decipher between intentional abuse and your misuse?
I'm only asking the implementation to detect identical observers
(including options and context). Of course it is perfectly possible
that someone finds a use for receiving multiple (identical) KVO
callbacks (although none spring to mind).
Bill Bumgarner wrote:
Now, this fragility may come as a slight surprise. However, KVO
is designed to be really really fast and, as such, loading it up
with a boatload of assertions and validation code would just slow
it down.
Efficiency may have taken precedence. We can only guess about how KVO
is implemented (and the rationale for doing it just so), but I would
speculate that more error checking in addObserver: / removeObserver:
methods wouldn't necessarily have a negative impact on the speed of
the dispatch mechanism.
Thanks again to everyone who chimed in. I have it on good authority
that the KVO documentation will receive enhancements...
patrick
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden