[Newbie] Morph class>>new

Christian Hofer christian.hofer at gmx.de
Sun Apr 13 14:06:34 UTC 2003


Hello,

I want to write a method like:

MyMorph class>>withTitle: aString
   ^self basicNew withTitle: aString

with:

MyMorph>>withTitle: aString
   title := aString.
   self initialize

Now I have seen that Morph implements the method "new" another way:

Morph class>>new
   ^super new initialize

instead of
   ^self basicNew initialize

Is there a reason for that? Is it dangerous to use the method I wrote?

BTW: I got a bit lost searching for the implementor of "new" - it should 
be Behaviour, but Object is not a subclass of Behaviour?! I suppose 
there is a really simple answer, so forgive me the stupid question.

BTW: I often forget to call "super initialize" in my
MyMorph class>>initialize
methods. This sometimes leads to Squeak crashing completely (not even 
alt-. does help) when I open MyMorph in World. Could there be something 
done about it?

BTW: It seems a bit strange to thank people in advance. But I would like 
to use the chance now to thank all those people who had the patience to 
answer my silly questions so far - especially Ned!

Christian



More information about the Squeak-dev mailing list