discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Why is +initialize not inherited?


From: David Ayers
Subject: Re: Why is +initialize not inherited?
Date: Sat, 21 Jan 2006 10:50:13 +0100
User-agent: Mozilla Thunderbird 1.0.2 (X11/20051002)

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]