• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: [self init] vs. [super init] in initWithCoder
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >[self init] vs. [super init] in initWithCoder (From: John McLaughlin <email@hidden>)
 >Re: [self init] vs. [super init] in initWithCoder (From: Ricky Sharp <email@hidden>)
 >Re: [self init] vs. [super init] in initWithCoder (From: John McLaughlin <email@hidden>)
 >Re: [self init] vs. [super init] in initWithCoder (From: glenn andreas <email@hidden>)
 >Re: [self init] vs. [super init] in initWithCoder (From: John McLaughlin <email@hidden>)
 >Re: [self init] vs. [super init] in initWithCoder (From: Jim Correia <email@hidden>)

  • Prev by Date: Re: Shareware app - check if trial time is over
  • Next by Date: Stacked NSDocument Windows
  • Previous by thread: Re: [self init] vs. [super init] in initWithCoder
  • Next by thread: Re: [self init] vs. [super init] in initWithCoder
  • Index(es):
    • Date
    • Thread