2012/6/16 Stéphane Ducasse <[email protected]>:
>>
>>
>> On Jun 15, 2012, at 12:06 PM, Stéphane Ducasse <[email protected]> 
>> wrote:
>>
>>> why do you need an automatic new method?
>>> Because by default
>>>   new invoke initialize
>>>
>>> and it works well.
>>>
>>
>> Stéphane, I have been using VW Smalltalk and it creates new classes ,by 
>> default, with a #new method on the class side and a #initialize method on 
>> the instance side.
>
> yes I always hated hated so much to force teacher to kill student on 
> metaclass altar after two weeks of smalltalk

Another point of view: creating an instance is on class side because
instances are created from a kind of structural template (how many
variables, etc...). You can also create an instance by cloning with
copy...

But initialize is on instance size because it modifies the private
instance variables:
one object can't directly modify another, except by kindly asking by
sending a message.
The instance is an object, the class is another, so the class kindly
ask the instance to initialize itself.

There's no trick here and it can't be more clear.
The only trick is how a class side new inherits from instance side
Behavior new, but we don't need this to explain initialize...

Nicolas

Reply via email to