• 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: Protecting singleton objects from releasing
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Protecting singleton objects from releasing


  • Subject: Re: Protecting singleton objects from releasing
  • From: publiclook <email@hidden>
  • Date: Sun, 16 Feb 2003 12:04:38 -0500

On Sunday, February 16, 2003, at 10:13 AM, Georg Tuparev wrote:

On Saturday, February 15, 2003, at 11:38 PM, publiclook wrote:

Is there any "recommended" way to protect singleton objects (e.g.
[NSProcessInfo processInfo]) from releasing? Overriding the release
method comes in mind, but I am wondering if there are better ways...

I recommend not protecting against this at all.

Fine if the class is to be used by programmers only. But how should I teach IB to read my documentation?

IB doesn't release objects in your application. If there is a problem releasing paletteized objects within IB, that is another issue. You question was about protection from releasing.

There is an issue with putting instances of supposed singleton objects in nibs.

First, It just doesn't make sense.

A singleton might own a nib. In fact the singleton NSApplication instance owns MainMenu.nib. If you have a singleton that needs connections to objects within a nib, perhaps your singleton should be the owner of the nib when it is loaded.

Even if you can think of a reason to put a singleton instance in a nib, it then doesn't make sense to load that nib multiple times. Even if you enforced the singleton nature of your object, the connections to the singleton would be broken and remade every time the nib was loaded. If there is a singleton instance in a nib file, doesn't that reasonably require that the nib file is only loaded once ?
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
References: 
 >Re: Protecting singleton objects from releasing (From: Georg Tuparev <email@hidden>)

  • Prev by Date: Re: ARCHIVING WITH CIRCULAR REFERENCES
  • Next by Date: Re: bug in AddressBook Framework headers
  • Previous by thread: Re: Protecting singleton objects from releasing
  • Next by thread: Re: Protecting singleton objects from releasing
  • Index(es):
    • Date
    • Thread