Hi Dave, thanks for replying.

On Apr 17, 2011, at 12:18 AM, Dave DeLong wrote:

> There are a whole bunch of ways to make singletons.  Some are much more work 
> than others...  

The amount of work is of little concern for me in this case because the 
singleton class will become a template like its @synchronized version already 
is, so I only have to do the work once.

> //if we overrode -init, then you could run into issues if you ever tried to 
> alloc/init a MySingleton multiple times

True.

> It's a lot shorter, because you don't have to worry about overriding all of 
> the <NSObject> memory management methods.  As long as you correctly retain 
> and release this object, it will never cease to exist.

The only reason why I have that particular implementation is that I've seen it 
done that way (but with @synchronized rather than dispatch_once()) in Apple's 
docs. Where exactly escapes me right now.

Thanks again.
WT

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to