About KCP and automatic initialize

ducasse ducasse at iam.unibe.ch
Tue Sep 9 08:42:23 UTC 2003


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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: KCP-0102-GeneralizeTheUseOfTheNewInitializePattern.cs
Type: application/octet-stream
Size: 4409 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20030909/160c35a9/KCP-0102-GeneralizeTheUseOfTheNewInitializePattern.obj


More information about the Squeak-dev mailing list