Re: retain and don`t retain in accessor methods
Re: retain and don`t retain in accessor methods
- Subject: Re: retain and don`t retain in accessor methods
- From: Clark Cox <email@hidden>
- Date: Sun, 15 Nov 2009 07:35:18 -0800
On Sat, Nov 14, 2009 at 11:35 PM, Ariel Feinerman <email@hidden> wrote:
> 2009/11/15 Kyle Sluder <email@hidden>
>
>> On Sat, Nov 14, 2009 at 2:35 PM, Ariel Feinerman <email@hidden>
>> wrote:
>> > I need two versions of -initWith ... and -set ... methods of custom timer
>> > class (for example, to prevent the circle references);
>>
>> Do not use accessors in your initializers or -dealloc.
>>
>
> Hm, it means to do the same work two times, I think. For example if I change
> the mechanism in the setting of instance variables, I must to change one in
> difference inits method; can you say a reason?
The reason often given (to which I don't personally subscribe) is that
the accessor could be overridden in a subclass, and therefore do
things that aren't appropriate (i.e. they could assume something about
the already-dealloc'ed or not-yet-init'ed portions of the subclass).
--
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:
This email sent to email@hidden