About KCP and automatic initialize

Daniel Vainsencher danielv at netvision.net.il
Tue Sep 9 11:37:03 UTC 2003


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.
> 
> --Boundary_(ID_hWMSUthVMd867cfagf9qxQ)
> Content-type: application/octet-stream; x-unix-mode=0644;
>  name=KCP-0102-GeneralizeTheUseOfTheNewInitializePattern.cs
> Content-transfer-encoding: quoted-printable
> Content-disposition: attachment;
>  filename=KCP-0102-GeneralizeTheUseOfTheNewInitializePattern.cs
> 
> '=46rom=20Squeak3.6beta=20of=20''4=20July=202003''=20[latest=20update:=20=
> #5395]=20on=2023=20August=202003=20at=204:21:54=20pm'!=0D=0D!Object=20=
> methodsFor:=20'initialize-release'=20stamp:=20'Noury=20Bouraqadi=20=
> 8/23/2003=2014:51'!=0Dinitialize=0D=09"Subclasses=20should=20redefine=20=
> this=20method=20to=20perform=20initializations=20on=20instance=20=
> creation"!=20!=0D=0D=0D!Behavior=20methodsFor:=20'instance=20creation'!=0D=
> new=0D=09"Answer=20a=20new=20initialized=20instance=20of=20the=20=
> receiver=20(which=20is=20a=20class)=20with=20no=20indexable=20variables.=20=
> Fail=20if=20the=20class=20is=20indexable."=0D=0D=09^=20self=20basicNew=20=
> initialize=0D!=20!=0D=0D!Behavior=20methodsFor:=20'instance=20creation'!=0D=
> new:=20sizeRequested=20=0D=09"Answer=20an=20initialized=20instance=20of=20=
> this=20class=20with=20the=20number=20of=20indexable=0D=09variables=20=
> specified=20by=20the=20argument,=20sizeRequested."=0D=0D=09^=20(self=20=
> basicNew:=20sizeRequested)=20initialize=0D!=20!=0D=0D=0D!UUID=20class=20=
> methodsFor:=20'instance=20creation'!=0Dnew=0D=09^self=20new:=2016!=20!=0D=
> =0DZipArchiveMember=20class=20removeSelector:=20#new!=0DXMLTokenizer=20=
> class=20removeSelector:=20#new!=0DWorldState=20class=20removeSelector:=20=
> #new!=0DVoice=20class=20removeSelector:=20#new!=0DView=20class=20=
> removeSelector:=20#new!=0DTwoLevelSet=20class=20removeSelector:=20#new!=0D=
> TwoLevelDictionary=20class=20removeSelector:=20#new!=0DTextPrinter=20=
> class=20removeSelector:=20#new!=0DTextMorphEditor=20class=20=
> removeSelector:=20#new!=0DTestRunner=20class=20removeSelector:=20#new!=0D=
> TestResult=20class=20removeSelector:=20#new!=0DTestResult=20=
> removeSelector:=20#initialize!=0DTestResource=20class=20removeSelector:=20=
> #new!=0DTelnetMachine=20class=20removeSelector:=20#new!=0D=
> TTCompositeGlyph=20class=20removeSelector:=20#new!=0DTTGlyph=20class=20=
> removeSelector:=20#new!=0DSystemVersion=20class=20removeSelector:=20=
> #new!=0DPluggableFileList=20class=20removeSelector:=20#new!=0DFileList2=20=
> class=20removeSelector:=20#new!=0DStringHolder=20class=20removeSelector:=20=
> #new!=0DSpeaker=20class=20removeSelector:=20#new!=0DSoundRecorder=20=
> class=20removeSelector:=20#new!=0DSerialPort=20class=20removeSelector:=20=
> #new!=0DScamper=20class=20removeSelector:=20#new!=0DSampledInstrument=20=
> class=20removeSelector:=20#new!=0DSAXHandler=20class=20removeSelector:=20=
> #new!=0DSARInstaller=20class=20removeSelector:=20#new!=0DResourceManager=20=
> class=20removeSelector:=20#new!=0DResourceCollector=20class=20=
> removeSelector:=20#new!=0DRandomEnvelope=20class=20removeSelector:=20=
> #new!=0DRandom=20class=20removeSelector:=20#new!=0DQuadrangle=20class=20=
> removeSelector:=20#new!=0DProcessBrowser=20class=20removeSelector:=20=
> #new!=0DPrintSpecifications=20class=20removeSelector:=20#new!=0D=
> PhonemeSet=20class=20removeSelector:=20#new!=0DParagraphEditor=20class=20=
> removeSelector:=20#new!=0DPHOReader=20class=20removeSelector:=20#new!=0D=
> ObjectWithDocumentation=20class=20removeSelector:=20#new!=0D=
> NebraskaServer=20class=20removeSelector:=20#new!=0DMultiCanvas=20class=20=
> removeSelector:=20#new!=0DMouseOverHandler=20class=20removeSelector:=20=
> #new!=0DMorph=20class=20removeSelector:=20#new!=0DMIDISynth=20class=20=
> removeSelector:=20#new!=0DLayoutProperties=20class=20removeSelector:=20=
> #new!=0DKlattSynthesizer=20class=20removeSelector:=20#new!=0D=
> KlattSegment=20class=20removeSelector:=20#new!=0DImports=20class=20=
> removeSelector:=20#new!=0DIRCConnection=20class=20removeSelector:=20=
> #new!=0DHtmlFormatter=20class=20removeSelector:=20#new!=0DHtmlEntity=20=
> class=20removeSelector:=20#new!=0DHTTPLoader=20class=20removeSelector:=20=
> #new!=0DFlashSoundInformation=20class=20removeSelector:=20#new!=0D=
> FlashSoundEnvelope=20class=20removeSelector:=20#new!=0DFlashKeyframes=20=
> class=20removeSelector:=20#new!=0DFlashColorTransform=20class=20=
> removeSelector:=20#new!=0DFlashCodec=20class=20removeSelector:=20#new!=0D=
> FilePackage=20class=20removeSelector:=20#new!=0DExternalObject=20class=20=
> removeSelector:=20#new!=0DExternalObject=20removeSelector:=20=
> #initialize!=0DExceptionSet=20class=20removeSelector:=20#new!=0D=
> EventSensor=20class=20removeSelector:=20#new!=0DDECTalkReader=20class=20=
> removeSelector:=20#new!=0DCustomMenu=20class=20removeSelector:=20#new!=0D=
> CosineInterpolator=20class=20removeSelector:=20#new!=0DController=20=
> class=20removeSelector:=20#new!=0DControlManager=20class=20=
> removeSelector:=20#new!=0DCommandHistory=20class=20removeSelector:=20=
> #new!=0DCodeLoader=20class=20removeSelector:=20#new!=0DClipboard=20class=20=
> removeSelector:=20#new!=0DClassBuilder=20class=20removeSelector:=20#new!=0D=
> CharacterSet=20class=20removeSelector:=20#new!=0DCharacterScanner=20=
> class=20removeSelector:=20#new!=0DCanvasEncoder=20class=20=
> removeSelector:=20#new!=0DCRStrokeFeature=20class=20removeSelector:=20=
> #new!=0DCRParameters=20class=20removeSelector:=20#new!=0DCREcho=20class=20=
> removeSelector:=20#new!=0DCRDisplayPropertiesInstanceBrowser=20class=20=
> removeSelector:=20#new!=0DCRDictionary=20class=20removeSelector:=20#new!=0D=
> ButtonProperties=20class=20removeSelector:=20#new!=0DBalloonEngine=20=
> class=20removeSelector:=20#new!=0DBalloonCanvas=20class=20=
> removeSelector:=20#new!=0DAttributedTextStream=20class=20removeSelector:=20=
> #new!=0DArchive=20class=20removeSelector:=20#new!=0DAbstractSound=20=
> class=20removeSelector:=20#new!=0DAbstractLauncher=20class=20=
> removeSelector:=20#new!=0DAbstractLauncher=20removeSelector:=20=
> #initialize!=0D=
> 
> --Boundary_(ID_hWMSUthVMd867cfagf9qxQ)
> MIME-version: 1.0
> Content-type: text/plain; charset=us-ascii
> Content-transfer-encoding: 7BIT
> 
> 
> 
> --Boundary_(ID_hWMSUthVMd867cfagf9qxQ)--



More information about the Squeak-dev mailing list