[Q] initialization pattern

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


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.
Even more interesting, when you send new to a
variable subclass, an instance of size 0 is
created and initialized (methods new, basicNew and
basicNew: cooperate to achieve this).

I stumbled over this peculiarity when I moved
some code to the 3.7 image.

This is of course not a real problem, but I think
it is a difference in behavior that causes the question
"Why?"

I would be pleased to read opinions about this
non-problem.

Greetings, Boris




More information about the Squeak-dev mailing list