Some questions about Squeak

Torge Husfeldt jean-jaques.gelee at gmx.de
Sat Nov 27 14:39:57 UTC 1999


----- Original Message ----- 
From: Stephane Ducasse <ducasse at iam.unibe.ch>
To: <squeak at cs.uiuc.edu>
Sent: Saturday, November 27, 1999 11:32 AM
Subject: RE: Some questions about Squeak


> Hi Andreas 
> 
> 
> You skip the most interesting of my questions: 
> >For example: it could be really good to have an automatic 
> >initialization protocol like in Clos, to avoid to have to define
> >everywhere this boring
> > new 
> > ^ super new initialize
No! Don't do it that way!
It is definetely not recommended to implement :

new 
    ^super new initialize 

in a class and its subclass, because initialize will be sent
twice (several times) to the same object. The super call
makes no difference here because the item returned by
super new does not know about it anymore.
So it is pretty easy to solve your problem without patching
the VM. It suffices to implement:

Object class>>new
    "Just do it here so my subclasses need not do it"
    ^super new initialize

Wait! Don't forget to implement first:

Object>>inititalize
    "Do nothing"
    ^self.

and delete all implementors of #new that
just do "super new initialize".
Since you were ready to patch the system in the VM,
it can't bu such a hard thing for you to patch Object class.
Be sure that every #initialize Method sends "super initialize"
where required.

Regards, Torge





More information about the Squeak-dev mailing list