On Thu, Nov 20, 2008 at 1:04 PM, Adam Leonard <[EMAIL PROTECTED]> wrote:

> However, I think it *would* be a bad idea to call [[[NSWorkspace
> sharedWorkspace]retain]autorelease]
> A good singleton will override -retain, -release, and -autorelease to do
> nothing and return an appropriate value. But since you know it's a singleton
> (through appropriate documentation), you really shouldn't be doing any
> memory management with it.

IMHO it is never a bad idea to manage an objects life time using
proper retain/release semantics, you shouldn't care that it is a
singleton, you should treat it just as any other object. I say this
because it is possible that at some point in the future it may no
longer be a singleton (granted for ones documented by Apple to be a
singleton you could make such assumptions but still I think you should
treat it like any other object).

In my own code when I write or use a singleton (app-life long
singleton) of my own creation I always treat it as an object that I
need to manage the life time of. I even implement and maintain a
proper dealloc method in the singleton. This allows me the freedom
change it away from being a singleton in the future in the need
arises.

-Shawn
_______________________________________________

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 [EMAIL PROTECTED]

Reply via email to