On Dec 13, 2011, at 1:47 PM, Kyle Sluder wrote: > Don't be tempted to add singleton smarts to -[Foo init]. ARC will not > like them. Instead, add a property to File's Owner that just returns > the shared Foo instance.
Really? Do you have a reference for that claim? I looked through http://clang.llvm.org/docs/AutomaticReferenceCounting.html and saw nothing about singletons. So much has been written about how -init is allowed to return a value other than what 'self' was at entry, I can't believe ARC can't handle it. FWIW, here's the body of my singleton-smart -init. if ( gSingleton!=NULL ) { [self release]; self = gSingleton; } else if ((self=[super init])!=NULL) { … } return self; _______________________________________________ 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