Re: Cocoa coding style (was Re: Did I reinvent the wheel?)
Re: Cocoa coding style (was Re: Did I reinvent the wheel?)
- Subject: Re: Cocoa coding style (was Re: Did I reinvent the wheel?)
- From: Andrew Merenbach <email@hidden>
- Date: Fri, 9 May 2008 20:47:16 -0700
I think that Chris Hanson was referring to the following note at the
very end of the article:
Situations could arise where you want a singleton instance (created
and controlled by the class factory method) but also have the
ability to create other instances as needed through allocation and
initialization. In these cases, you would not override
allocWithZone: and the other methods following it as shown in
Listing 2-15.
I'm not supporting either point of view as a "best practice," as I
don't use singletons much, but I can see where this misunderstanding
may have arisen.
Cheers,
Andrew
On May 9, 2008, at 8:32 PM, Michael Watson wrote:
And do not override any of the following to implement singletons! -
allocWithZone: -copyWithZone: -retain -retainCount -release -
autorelease Instead, just add a "+sharedWhatever" class method.
<http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaFundamentals/CocoaObjects/chapter_3_section_10.html
>
--
m-s
_______________________________________________
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
_______________________________________________
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