On 16 June 2012 10:46, Stéphane Ducasse <[email protected]> wrote: > > On Jun 16, 2012, at 11:00 AM, Nicolas Cellier wrote: > >> 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 > > what is the 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… > > I have been there. Teaching a lot during many years and there is no simple > explanation: after two hours of lecture you do not want to explain > metaclasses. Just because people forgot (CLOS did not do this mistake) to > invoke an initialize method when creating an object.
Stéphane, would you mind expanding a bit on what mistake CLOS didn't make? frank > At the end I added in all my system the Behavior new>> self basicNew > initialize > and the students were happy and me too. > > >> 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 >> > >
