Re: Question about Style wrt "private" methods
Re: Question about Style wrt "private" methods
- Subject: Re: Question about Style wrt "private" methods
- From: Jim Correia <email@hidden>
- Date: Wed, 18 Nov 2009 14:15:20 -0500
On Nov 18, 2009, at 1:49 PM, Jens Alfke wrote:
This is unfortunately true. The danger is that if you add an _-
prefixed method to your class, it might conflict with a private
method declared in a superclass. If this happens your method will
override the internal one, and Really Bad Things will probably
happen. It's a rare problem but it has happened before. (And even if
everything works well now, any future OS update might add a new
private method in a superclass that breaks your code. Again, this
has actually happened.)
This problem is just not restricted to private methods, or additions
through categories. You can also run afoul of a namespace conflict
with a public method in your subclass.
Suppose you have a subclass of NSView which adds -
reallyNiceMethodThatOughtToBeInAppKit. If Apple adds such a method in
the next OS release, the same kinds of problem can result. (Similar
problems when you extend delegate protocols for your subclasses too.)
This problem is much less insidious than the category problem, but the
potential does exist. (For both private and public methods.)
- Jim
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden