Re: How dangerous is +load?
Re: How dangerous is +load?
- Subject: Re: How dangerous is +load?
- From: Marcel Weiher <email@hidden>
- Date: Thu, 1 May 2003 08:51:33 +0200
On Thursday, May 1, 2003, at 07:11 Uhr, Georg Tuparev wrote:
On Thursday, May 1, 2003, at 02:55 Europe/Amsterdam, Daniel Zitter
wrote:
Georg wrote:
But I really do not want to create any
dependancies between the class in question and NSApp or its delegate.
I am confused by this requirement. One line of initialization code in
the app or app delegate class is a small dependancy. Could you
elaborate on the motivation for this requirement? Can we not assume
you have the ability to recompile the application(s) you wish to >> test?
What if the class of interest is a part of a plugin, and the original
author of NSApp's delegate have no idea about the existence of this
plugin? But even if this is not the case, one line of dependancy is
one line too much.
Well, if you're in a plugin, then you have a pretty good chance that
Foundation has already been loaded, right? After all, your plugin was
loaded by NSBundle and NSBundle is part of Foundation, so Foundation
must be there.
In general, however, I don't really think you can actually *rely* on
anything in +(void)load, and its use should generally be avoided. I
think the docs already strongly discourage it. In a bundle
environment, use a protocol between the app and the bundle's principal
class, for example.
If you can't do that (now what exactly are you doing? ;-), then I think
you'll just have to 'rely' on "it works now".
Marcel
--
Marcel Weiher Metaobject Software Technologies
email@hidden www.metaobject.com
Metaprogramming for the Graphic Arts. HOM, IDEAs, MetaAd etc.
_______________________________________________
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.