Re: Protecting singleton objects from releasing
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.