[Q] initialization pattern

Boris Gaertner Boris.Gaertner at gmx.net
Sun May 16 16:36:21 UTC 2004

"stéphane ducasse" <ducasse at iam.unibe.ch> wrote:

On 16 mai 04, at 17:36, Boris Gaertner wrote:

>> With change set 5503 a new initialization pattern
>> was introduced: The method Behavior>> new
>> sends the message initialize to the newly created
>> instance. This has some advantages (also, but not only,
>> for teaching) and will hardly ever cause problems.
>> Interestingly, the object creation pattern for
>> variable subclasses was left unchanged: The
>> method Behavíor>>new: does not send the message
>> initialize to the newly created object.

>Seems to me a mistake because new: should call also initialize or may
>be initialize:

That is quite possible, I found that on 2003-09-09
you posted a change set that contained (among
other things) this definition:

Behavior methodsFor: 'instance creation'
new: sizeRequested
 "Answer an initialized instance of this class with the number of indexable
 variables specified by the argument, sizeRequested."

 ^ (self basicNew: sizeRequested) initialize

I still could not find out why this got lost. I will try to
find out but perhaps a KCP fellow has a quick

Greetings, Boris

More information about the Squeak-dev mailing list