About KCP and automatic initialize

Julian Fitzell julian at beta4.com
Tue Sep 9 15:51:42 UTC 2003


Yes, I'd like to see this go in as well.  We'll have to be pretty 
careful to figure out when to do it and how to manage compatibility so 
that everybody can update their code at the right time (it would be nice 
if there was some way to make it work in both the new and previous 
images at once though...).

Julian

Daniel Vainsencher wrote:
> I agree that this would be a good thing. IMO, implementation of new to
> call initialize is one of a few little idioms that people would be
> better off not having to learn and apply all the time.
> 
> Daniel
> 
> ducasse <ducasse at iam.unibe.ch> wrote:
> 
>>--Boundary_(ID_hWMSUthVMd867cfagf9qxQ)
>>Content-type: text/plain; charset=US-ASCII; format=flowed
>>Content-transfer-encoding: 7BIT
>>
>>hi all
>>
>>Noury in the context of KCP proposes to introduce the fact that new 
>>invokes automatically initialize
>>(like it was in CLOS and also in the new implementation of John Brant 
>>for his smalltalk on .net).
>>In the VW mailing list there was a short discussion and everybody there 
>>agree that they would like to have that.
>>The problem is that cincom has a big client basis so this will never 
>>happen even if eliot would like.
>>
>>We (the people of Berne) really wants this stuff to get in Squeak 
>>because:
>>
>>	- it will make the life of newcomer much easier
>>		to initialize an object you just redefine the method initialize
>>		no "class new and pay attention that it is not define in the super 
>>class..."
>>	
>>	- it also remove duplicated methods and even double initialization
>>
>>	- we still have the possibility to call basicNew when we want to have 
>>a non initialized object.
>>	So we have the complete power to control our life while now new is 
>>sometimes returning initialized object
>>	sometimes not.
>>	
>>	- the run-time cost are the following:
>>		In order to evaluate the effect of this change on performance I run 
>>macrobenchmark on my laptop PIII 		1.2GH with 256MB RAM. Here are the 
>>result I got.
>>		- Before loading the change set: #(6187 68898 21508 9724 0 7097 7097)
>>		- After loading the change set: #(6683 70241 21210 10757 0 6815 6815).
>>		- Percentages of After/Below:  #(108 101 98 110 - 96 96)
>>	When percentage are less than 100, they mean that the change improve 
>>performance.
>>
>>	Note that this benchmark do not include any tricks: shortcuting the 
>>call on array for example, nor
>>	replacing some new by basicNew when we know that initialize should not 
>>be called. So this is clear that
>>	we could fine tune the performance and obtain a simpler model.
>>
>>	- the migration cost is that we will have to check all our 
>>applications and remove these wonderful
>>	 new ^super new initialize expressions fro everywhere to avoid double 
>>initialize invocation. Noury
>>	already did that for the image.
>>
>>So we would like to know what other people think about that. Please 
>>think that we ***really*** pay attention of Squeak and that this is not 
>>"another stuff of these researchers" because we have much more exciting 
>>stuff that will never go in Squeak. This is just to catch up with the 
>>mistakes of the past. CLOS came 10 years after smalltalk and they had
>>the time to think about that.
>>
>>The idea behind this change is to have a cleaner model that people can 
>>use. And that newcomers will not have to think about metaclass in the 
>>first lecture (why in new ^ super new initialize does not return an 
>>instance of the superclass?), if you already taught Smalltalk you know 
>>what I mean.
>>
>>Stef in the name of the other KCPers
>>
>>here is the changeset if you want to have a look at it.



-- 
julian at beta4.com
Beta4 Productions (http://www.beta4.com)



More information about the Squeak-dev mailing list