• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
RE: + initialize docs conflict?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: + initialize docs conflict?


  • Subject: RE: + initialize docs conflict?
  • From: Jeff Laing <email@hidden>
  • Date: Tue, 1 Feb 2005 16:20:31 +1100

At the risk of demonstrating my ignorance yet again ...

> 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."

... is there some circumstance where this might be other than a bug in
someones code?

ie, I can see clearly that

+ initialize
{
	[super initialize];
	// other stuff
}

would be in error.

(In fact, I'm not sure if it would compile.  Is super defined for class
messages, or only for instance messages? (am I even using the right jargon?
;))

The runtime system already guaranteed to call my superclasses initialize
method, so it makes no sense for me to do it as well - its clearly a bug and
as such it should be fixed.

Thus, is it sensible to have the one-shot flag test just silently ignore the
second call?  Would it not be better to throw an exception?  Is there some
legitimate construct where the second initialize call might be made, and an
assertion would be "a bad thing(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

  • Prev by Date: Re: + initialize docs conflict?
  • Next by Date: Finding Subnet
  • Previous by thread: Re: + initialize docs conflict?
  • Next by thread: resend newbie on Chinese/unicode
  • Index(es):
    • Date
    • Thread