Re: + initialize docs conflict?
Re: + initialize docs conflict?
- Subject: Re: + initialize docs conflict?
- From: Ricky Sharp <email@hidden>
- Date: Tue, 01 Feb 2005 06:12:54 -0600
On Monday, January 31, 2005, at 11:08PM, Charlton Wilbur <email@hidden> wrote:
>On Jan 31, 2005, at 6:53 PM, Ricky Sharp wrote:
>
>> When reading up on NSObject's class method 'initialize', I found these
>> two quotes in the docs:
>>
>> "Each class receives the initialize message just once from the runtime
>> system."
>>
>> "Normally the runtime system sends a class just one initialize
>> message. However, if for some reason an application or the runtime
>> system generates additional initialize messages, it is a good idea to
>> prevent code from being invoked more than once"
>>
>> I can see where an application developer may (accidentally?) have code
>> to call initialize more than once. But why do the docs have
>> conflicting statements regarding the runtime?
>
>Bill Cheeseman has already replied to this, but I'd like to point out
>one way in which these two statements are not contradictory. The
>*runtime system* sends the initialize message on its own behalf exactly
>once, but it's possible that *applications* may send the initialize
>message -- or, possibly, some chain of events might cause something
>else to send the class the initialize message.
But the problem I have with the docs is the 2nd quoted statement which mentions "...if for some reason an application or the runtime...". It's the "or the runtime" portion that makes it sound like the runtime may actually send more than one initialize message on its own. At least that's how I read it.
As you'll see in another reply, I've filed a bug against the docs :)
>> I have no problem modifying my initialize implementations with a
>> one-shot flag if need be. However, if the runtime is only ever
>> suppose to call initialize once, I'll then file a bug against the
>> docs.
>
>I do think they ought to be clarified. "The runtime system sends each
>class the +initialize method exactly once on its own behalf, but other
>classes or the +initialize message of subclasses may also send an
>+initialize method. As a result, the runtime system does not guarantee
>that +initialize will only be called once, and so it may be necessary
>to explicitly prevent code from being invoked more than once."
I think your description here makes much more sense.
Thanks,
Rick Sharp
Instant Interactive(tm)
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden