On Oct 3, 2011, at 10:14 AM, John Tsombakos wrote:

> (and will also change to use the underscore ivar names too - I had done that 
> previously, but...well, didn't this time.)

I recommend using some other prefix system instead of the underscore, for two 
reasons:

1. Apple reserves the underscore prefix for their own use, so you could, at 
least theoretically, clash with a superclass ivar this way, and

2. KVO’s “access instance variables directly” (mis)feature recognizes the 
underscore prefix. I like to give it a prefix that KVO doesn’t know about so 
that I can be sure never to end up accidentally accessing the ivars of another 
object without going through the proper accessors.

3. If I use an ivar prefix that no one else uses (as far as I know), then I can 
make my class into a subclass of something from a publicly available framework 
without needing to worry about ivar name clashes.

Charles_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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 arch...@mail-archive.com

Reply via email to