• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: bindings duplicates object returned
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bindings duplicates object returned


  • Subject: Re: bindings duplicates object returned
  • From: Eric Slosser <email@hidden>
  • Date: Tue, 13 Dec 2011 14:26:37 -0500

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 (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

References: 
 >bindings duplicates object returned (From: Eric Slosser <email@hidden>)
 >Re: bindings duplicates object returned (From: Quincey Morris <email@hidden>)
 >Re: bindings duplicates object returned (From: Eric Slosser <email@hidden>)
 >Re: bindings duplicates object returned (From: Eric Slosser <email@hidden>)
 >Re: bindings duplicates object returned (From: Kyle Sluder <email@hidden>)

  • Prev by Date: Re: bindings duplicates object returned
  • Next by Date: Re: How select NSTextField programatically?
  • Previous by thread: Re: bindings duplicates object returned
  • Next by thread: App crashing when adding to Open Recent menu
  • Index(es):
    • Date
    • Thread