On Fri, 07 Oct 2011 19:46:17 -0400, Andy Lee <ag...@mac.com> said:
>On Oct 3, 2011, at 2:23 PM, Charles Srstka wrote:
>> 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.
>
>Ooh, hadn't thought of that.
>
>Maybe now's the time to start using spiffy compiler features like synthesized 
>ivars, and to stop declaring ivars at all.

But please insert here some boilerplate grumbling about the vast undocumented 
namespace in which you're operating. I did everything "right" when I named an 
ivar "firstResponder" (property, synthesized ivar, synthesized accessors) and 
totally broke my app because Apple was apparently already using an undocumented 
ivar called "firstResponder".

http://www.cocoabuilder.com/archive/cocoa/296662-assign-property-behaves-differently-from-simple-instance-variable.html

Also, note that there are circumstances where a synthesized ivar won't work; 
see, for instance, this note:

http://www.cocoabuilder.com/archive/cocoa/298320-inherited-implicitly-created-member-is-no-member.html

m.

--
matt neuburg, phd = m...@tidbits.com, <http://www.apeth.net/matt/>
A fool + a tool + an autorelease pool = cool!
Programming iOS 4!
http://www.apeth.net/matt/default.html#iosbook_______________________________________________

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