discuss-gnustep
[Top][All Lists]
Advanced

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

Re: has my bug report & fix been submitted (in NSProcessInfo.m)?


From: David Ayers
Subject: Re: has my bug report & fix been submitted (in NSProcessInfo.m)?
Date: Wed, 20 Jul 2005 09:40:11 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; rv:1.7.8) Gecko/20050513 Debian/1.7.8-1

Sheldon Gill wrote:

> 
> And my point is that the *runtime* can call a particular +initialize
> implementation more than once due to inheritance. If ClassA implements
> +initialize and ClassB derives from ClassA without overriding it then
> that specific implementation will be called *twice*.
> 
> Apple docs, 'The Objective-C Language' page 50:
> "Note that since initialize is inherited, it may be called multiple
> times on behalf of subclasses."
> 
> Anyway, aren't we basically in agreement about all this?

Yes, but please be aware that the semantics of the GNU runtime differ
and we believe this to be bug in the apple runtime.  And IIRC some
libobjc folks at Apple agree, but they didn't want to break
compatibility to existing projects that already relied on this behavior.
(I believe it was an OMNI project, but I'm not certain.)

IMHO, I think we should stick with the general rule that code should:
a) never call initialize explicitly
b) never call super in initialize implementations
c) guard against multiple calls

In this case, IIUC there is need for some lazy initialization that may
have to be invoked after +initialize.  My suggestion would be to extract
that to a different class method that you can invoke explicitly but also
have +initialize call it.

Cheers,
David




reply via email to

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