Larry Campbell schrieb:
> In Apple's runtime +initialize is inherited (and this is documented,  so
> it's not by accident). In gnustep it's not. Is there a good reason  for
> this? It seems like a glaring inconsistency -- "subclasses  inherit
> methods from their superclass _unless_ the method is called 
> +initialize". Seems to me it would be much cleaner to not special- case
> this and for +initialize to be inherited.

Have a look at this discussion:

http://lists.apple.com/archives/objc-language/2004/Mar/msg00006.html

Now, I'm no advocate of being different just for the sake of being
different, but I also think that '+load' and '+initialize' are simply
"special" wrt inheritance and guarantees on how/when they are called and
I would assume that we would break code written for the FSF libobjc
runtime if FSF's libobjc started to inherit +initialize.

Note that if you actually invoked either +initialize or +load in a true
method invocation, the normal inheritance techniques would be used.  But
be warned, code often is not prepared for multiple invocations of these
methods and could break in strange ways (e.g. replacing objects/caches
which were meant to be initialized as singletons).

Cheers,
David


_______________________________________________
Discuss-gnustep mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/discuss-gnustep

Reply via email to