[Newbie] Morph class>>new
Stephane Ducasse
ducasse at iam.unibe.ch
Sun Apr 13 17:32:36 UTC 2003
>
> Always call super in your initialize method. This should not be hard
> to
> remember since the initialize protocol is not something you create
> yourself, ie. you should not be calling #initialize yourself, it is
> called automatically in Morph class>>new. So if you implement
> #initialize you know you are overriding a super protocol.
>
Hi
the advice of anthony is nearly true. You can always call super
initialize in a initialize ***if*** you are inheriting from Morph
because Morph implement initialize.
When you inherit from Object, Object does not implement initialize
because it is inconsistent and therefore it would produce an error. So
always check whether one of your superclass implement initialize before
doing a super initialize.
This is months that we should come up with a proof that automatically
calling
initialize from new does not cost too much and then is worth been
introduced in Squeak but lack of time ;(
Prof. Dr. Stéphane DUCASSE
http://www.iam.unibe.ch/~ducasse/
"if you knew today was your last day on earth, what would you do
different? ... especially if,
by doing something different, today might not be your last day on
earth" Calvin&Hobbes
"The best way to predict the future is to invent it..." Alan Kay.
Open Source Smalltalks: http://www.squeak.org,
http://www.gnu.org/software/smalltalk/smalltalk.html
Free books for Universities at
http://www.esug.org/sponsoring/promotionProgram.html
Free Online Book at
http://www.iam.unibe.ch/~ducasse/WebPages/FreeBooks.html
Prof. Dr. Stéphane DUCASSE
http://www.iam.unibe.ch/~ducasse/
"if you knew today was your last day on earth, what would you do
different? ... especially if,
by doing something different, today might not be your last day on
earth" Calvin&Hobbes
"The best way to predict the future is to invent it..." Alan Kay.
Open Source Smalltalks: http://www.squeak.org,
http://www.gnu.org/software/smalltalk/smalltalk.html
Free books for Universities at
http://www.esug.org/sponsoring/promotionProgram.html
Free Online Book at
http://www.iam.unibe.ch/~ducasse/WebPages/FreeBooks.html
More information about the Squeak-dev
mailing list
|