On Sat, Jan 10, 2009 at 12:09 AM, Kyle Sluder <[email protected]> wrote: > On Fri, Jan 9, 2009 at 11:49 PM, Michael Ash <[email protected]> wrote: >> Note that the problems, such as they are, with calling setters only >> show up if your class is subclassed and the subclass does something >> weird that doesn't like being called when the rest of the subclass >> isn't initialized. If you're not subclassing your own class (or you >> are but you aren't doing anything weird like this in it) then you are >> perfectly safe. > > So what happens if Apple changes your superclass to observe itself? > All of a sudden you start firing KVO notifications off when you didn't > mean to.
Your superclass is fully initialized by this point. It should be able to handle any KVO notifications arriving without any trouble. Furthermore, if it's observing itself it's presumably because it wants to know when the value changes. (That's the whole point of the thing, after all.) Triggering the observer is therefore a *good* thing, and bypassing it is likely to cause problems. The problem isn't with superclasses, it's with subclasses. And they only have a problem if they are behaving in a manner which, in my opinion, is buggy. Opinions may vary there, but regardless of that, the facts are that calling your superclass's setter is the right way to do things. Mike _______________________________________________ Cocoa-dev mailing list ([email protected]) Please 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [email protected]
