Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: @property question



On Mon, May 12, 2008 at 3:42 PM, Phoenix Draco
<email@hidden> wrote:
>
>  Sorry if this is naïve but I have a quick follow up q (to verify that I am
>  understanding ObjC correctly). Is it true that:
>
>  The two styles seem to me to have slightly different execution paths. The
>  first:
>
>  [self.fieldArray addObject:inFoo]
>
>  Would actually invoke the property accessor fieldArray and then send the
>  message addObject: to the returned result, i.e. Its equivalent to:
>
>  [[self getfieldArray] addObject:inFoo]

Correct, except for the fact that the method is called "fieldArray":

"[self.fieldArray addObject:inFoo]" is equivalent to "[[self
fieldArray] addObject:inFoo]" in all respects except for syntax


>  While the second form [fieldArray addObject:inFoo] would directly use the
>  member variable.
>
>  So if you (for some reason) chose to have a more complicated accessor that
>  is not simply backed by an ivar, the former may have some potential side
>  effects, yes?
>
>  Thanks,
>  Phoenix
>
>
>  On 5/12/08 3:19 PM, "Craig Hopson" <email@hidden> hollered from the
>  keytops:
>
>
>
>  > Guys,
>  >
>  > I think I've been the victim of some side effect that I cannot track
>  > down. With no other changes, I tried again with each style,
>  > [ self.fieldArray addObject:inFoo ];
>  > [ fieldArray addObject:inFoo ];
>  > replacing all occurrences for each test, and both work - what I would
>  > have expected.
>  >
>  > Thanks for your input.
>  > -Craig
>  > _______________________________________________
>  >
>  > 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:
>  > http://lists.apple.com/mailman/options/cocoa-dev/aurora.phoenix.draco%40gmail.
>  > com
>  >
>  > This email sent to email@hidden
>
>
>
>
>  _______________________________________________
>
>  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:
>  http://lists.apple.com/mailman/options/cocoa-dev/email@hidden
>
>  This email sent to email@hidden
>



-- 
Clark S. Cox III
email@hidden
_______________________________________________

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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden

References: 
 >Re: @property question (From: Craig Hopson <email@hidden>)
 >Re: @property question (From: Phoenix Draco <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.