Re: A Data Object in Cocoa
Re: A Data Object in Cocoa
- Subject: Re: A Data Object in Cocoa
- From: "Michael Ash" <email@hidden>
- Date: Sun, 11 Jan 2009 00:48:15 -0500
On Sat, Jan 10, 2009 at 3:33 PM, Andy Lee <email@hidden> wrote:
> On Saturday, January 10, 2009, at 12:39PM, "email@hidden" <email@hidden> wrote:
>>For what it's worth Anguish et al states (p99) that Apple reserves the
>>right to change "private" instance variables that begin with an
>>underscore and no prefix.
>
> On Saturday, January 10, 2009, at 02:40PM, "email@hidden" <email@hidden> wrote:
>>I agree that it is confusing, or meaningless, but I thought it might
>>have contributed to the _ misconception.
>>A Google for - anguish "underscores and usage" - will show the passage
>>I referred to.
>
> It sounds like the risk is that Apple could rename one of their _ivars so the new name collides with one of your _ivars that previously was okay. You would quickly discover this the next time you compile, but I assume existing users of your app would find it suddenly crashes after their last OS update. Anguish et al. recommend mitigating this risk by using a unique prefix in addition to the underscore.
Except that if Apple renames one of their ivars to match the name of
one of your subclass's ivars.... nothing happens. You don't crash, you
don't misbehave. Everything continues on like usual.
Unlike methods, ivars are *not* looked up by name, but rather by offset.
(This is no longer true if you're using KVC direct ivar access but,
well, just another reason why you shouldn't do that.)
Mike
_______________________________________________
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