• 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: Is Apple's singleton sample code correct?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Is Apple's singleton sample code correct?


  • Subject: Re: Is Apple's singleton sample code correct?
  • From: Shawn Erickson <email@hidden>
  • Date: Sat, 26 Nov 2005 08:31:18 -0800


On Nov 26, 2005, at 8:12 AM, Shawn Erickson wrote:

It of course also relies on overriding retain/release (and others as needed) to allow normal use of retain and release without affecting the existence of the singleton.

This was poorly stated... I was trying to say that a singleton can be implemented to be lazily allocated and with the assumption it will exist for the life of the process. This assumption can lead to implementation choices in the singleton that require it has no chance of being dealloced and in order to defend against that you can rely on overriding retain/release/etc. Again just a choice of attempting to be defensive compared to relying on the detection of a usage defect... which makes sense is often a matter of opinion and can depend on the situation.


Anyway likely enough on this subject... (as you see I try not to speak in absolutes since seldom anything in programming styles/ patterns truly are).

-Shawn
_______________________________________________
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


References: 
 >Is Apple's singleton sample code correct? (From: David Gimeno Gost <email@hidden>)
 >Re: Is Apple's singleton sample code correct? (From: Shawn Erickson <email@hidden>)
 >Re: Is Apple's singleton sample code correct? (From: David Gimeno Gost <email@hidden>)
 >Re: Is Apple's singleton sample code correct? (From: Shawn Erickson <email@hidden>)
 >Re: Is Apple's singleton sample code correct? (From: David Gimeno Gost <email@hidden>)
 >Re: Is Apple's singleton sample code correct? (From: Shawn Erickson <email@hidden>)

  • Prev by Date: Re: Is Apple's singleton sample code correct?
  • Next by Date: Re: retrieve a milliseconds interval with obj-C
  • Previous by thread: Re: Is Apple's singleton sample code correct?
  • Next by thread: Re: Is Apple's singleton sample code correct?
  • Index(es):
    • Date
    • Thread