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: Michael Watson <email@hidden>
- Date: Sat, 10 May 2008 00:49:47 -0400
I'm sure that he was, but without qualification, I thought it might
read more like an absolute to some, so I linked to the singleton
document . . . without providing any qualification for doing so,
myself, sadly.
--
m-s
On 09 May, 2008, at 23:47, Andrew Merenbach wrote:
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