Re: [self init] vs. [super init] in initWithCoder
Re: [self init] vs. [super init] in initWithCoder
- Subject: Re: [self init] vs. [super init] in initWithCoder
- From: John McLaughlin <email@hidden>
- Date: Sat, 19 Aug 2006 19:58:46 -0700
This is a very good point.
I've sort of turned around at this point and decided to change my
patterns to create to support [super init].
Thanks all for the nice discussion.
-John
On Aug 19, 2006, at 2:14 PM, Jim Correia wrote:
On Aug 19, 2006, at 12:41 PM, John McLaughlin wrote:
You bring up a good point -- In my case I use Accessorizer
extensively so I never, ever, set anything except through setters
so I wouldn't leak (although it is arguable less efficient since
you init an object that then immediately get's deallocated)
There are caveats/considerations to using public accessor methods
from -init or -dealloc. Since they are public, they can be
overridden by subclasses (and will potentially have side effects
even if the original methods did not.) If a subclass overrides a
public accessor, and you use it from init, the subclass may not be
prepared to deal with a partially constructed object. Something to
consider...
Jim
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
John McLaughlin
http://www.loghound.com
email@hidden
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden