• 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: isa
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: isa


  • Subject: Re: isa
  • From: Ondra Cada <email@hidden>
  • Date: Sun, 2 Jun 2002 02:24:13 +0200

On Saturday, June 1, 2002, at 11:22 , Aram Greenman wrote:

...sending messages to self in an initalizer, which is _usually_ a bad idea,

Quite the contrary. It is very, very often an extremely good idea. Just please have a look at the "designated initializer" stuff.

since it is possible the method called might access unitialized instance variables, depending on where you are in the initializer chain.

Agreed that this is some slight danger incurred by it, which has to be worked around by a good documentation and common sense.

Setting isa temporarily to the class which defines the -init would protect against this.

As a matter of fact, I see [self whatever] in init many times less a danger than isa swizzling. Might be arguable, but at the very least least the former is quite standard, documented behaviour, whilst the latter is kinda hack.
---
Ondra Cada
OCSoftware: email@hidden http://www.ocs.cz
2K Development: email@hidden http://www.2kdevelopment.cz
private email@hidden http://www.ocs.cz/oc
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
References: 
 >Re: isa (From: Aram Greenman <email@hidden>)

  • Prev by Date: Re: about_header_files
  • Next by Date: keeping a view at a given aspect ratio?
  • Previous by thread: Re: isa
  • Next by thread: Re: isa
  • Index(es):
    • Date
    • Thread