initialize methods... when do they get called?

Bob Arning arning at charm.net
Mon Jan 27 02:08:53 UTC 2003


On Sun, 26 Jan 2003 17:56:04 -0800 Derek Brans <brans at nerdonawire.com> wrote:
>Does instance>>initialize get called anytime an instance is created?  Is 
>it guaranteed?  Should I override "new" on the class side to say super 
>new initialize?

Depends on the class. Morph does this already, so any subclass (unless you make changes to defeat this) will also do an #initialize as a part of #new. For other classes, you may need to do something similar yourself.

>When does class>>initialize get called?

The only "automatic" time is when filing out a class #initialize method, a doit is normally included that sends #initialize to the class after filing in. Other than that, it's up to you to decide when you need to call it.

Cheers,
Bob



More information about the Squeak-dev mailing list