Re: Is Apple's singleton sample code correct?
Re: Is Apple's singleton sample code correct?
- Subject: Re: Is Apple's singleton sample code correct?
- From: Shaun Wexler <email@hidden>
- Date: Wed, 30 Nov 2005 18:10:37 -0800
On Nov 30, 2005, at 3:42 PM, David Gimeno Gost wrote:
On 29 Nov 2005, at 19:30, Shaun Wexler wrote:
Please refer to the "hardcore" singleton base superclass I posted
a few years ago:
<http://www.cocoabuilder.com/archive/message/cocoa/2004/2/13/97027>
If I understand it correctly, your implementation avoids the
repeated -init call problem by raising an exception if
[[MySingleton alloc] init] is called by client code. This is not
the problem we were trying to solve. We wanted to allow
[[MySingleton alloc] init] to be called as for any other class. I
see no point in all that overhead just to ensure that client code
never attempts to do that.
Moreover, your implementation still has all the other problems I
mentioned about the Apple's sample code implementation, so I really
don't see what the point is here.
You're making this too difficult for yourself.
All you need to do [with my code, referenced above] to get the
behavior you want is comment out all [self doesNotRecognizeSelector:]
and [NSException raise:] messages.
Try it... sheesh! ;)
--
Shaun Wexler
MacFOH
http://www.macfoh.com
"Problems cannot be solved by the same level of thinking that created
them." - Albert Einstein
_______________________________________________
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