• 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
self = [super init] debate.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

self = [super init] debate.


  • Subject: self = [super init] debate.
  • From: Scott Andrew <email@hidden>
  • Date: Sun, 10 Feb 2008 09:18:45 -0800

Ok. Myself, like most Cocoa engineers have learned to write initializers like so:

-(id) init
{
	self = [super init];

	if (self != nil)
	{
		.. do my init
	}

	return self;
}

So my question is:

As i get ready to teach non-cocoa programmers in my company about cocoa programming, and having read Will Shipley's blog, Is the above the way to teach writing an initializer? I see Will, and a few others, say no [super init] will initialize self in its code there is no reason to assign self. Yet all code and docs I see have similar code.

Arguments for and against? I know old debate.... ;-)

Scott Andrew
_______________________________________________

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


  • Follow-Ups:
    • Re: self = [super init] debate.
      • From: Jens Alfke <email@hidden>
    • Re: self = [super init] debate.
      • From: Quincey Morris <email@hidden>
    • Re: self = [super init] debate.
      • From: Scott Andrew <email@hidden>
  • Prev by Date: Re: Drawing to NSView with OpenGL questions
  • Next by Date: Re: self = [super init] debate.
  • Previous by thread: Re: Drawing to NSView with OpenGL questions
  • Next by thread: Re: self = [super init] debate.
  • Index(es):
    • Date
    • Thread