About KCP and automatic initialize

ducasse ducasse at iam.unibe.ch
Thu Sep 11 06:23:02 UTC 2003


On Jeudi, sep 11, 2003, at 01:52 Europe/Zurich, Richard A. O'Keefe 
wrote:

> I asked:
> 	> I've forgotten, is there any reason to prefer
> 	>     ^super new initialize
> 	> to  ^self basicNew initialize
> 	> The latter has the advantage of not repeating super initialize.
>
> ducasse <ducasse at iam.unibe.ch> wrote:
> 	But you lose the actions done in new in the superclasses.
>
> Yes, that's the POINT of doing it that way,
> as "the latter has the advantage of NOT repeating super initialize"
> would, I thought, have made clear.
>
> What I'm thinking is that if people go around stuffing up the kernel
> making Object new send #initialize, I'm going to have to switch over
> to using self basicNew in my toplevel classes instead of super new
> precisely to avoid that harassment.

I should say that you puzzled me.


	^ self basicNew initialize will invoke initialize and if initialize
	call super initialize it will get called.

	This is the same with
	^ self super new initialize
	
	of course if ***you*** duplicate ^ super new initialize in the 
hierarchy it will
	get called twice. This pattern is the simplest way (we are working on 
other on our research side)
	to provide a good default mechanism. This is what we are looking a 
default mechanism that catch
	90 % of the cases but let people do their 10%.

Then if you really need to only call one allocate and initialize then 
the right patterns
is indeed to use self basicNew initialize.

But still I'm puzzled. Why would you need that to avoid one call to 
initialize that is empty????
Really one call in Squeak. Eliot says that in VW the costs would be 
completely invisible because of the
iniline cache, the benchmark that noury sent prove that without any 
tricks we can really good
result.


Stef


You know why I'm sad because I think that the best way would be to 
start a new language but even as a research
group we do not have the power to get something. When I see that 
language such as ruby as kind of mixin, modules.....I'm ***really*** 
wondering if we are not trapped in our old nice rusty cage





More information about the Squeak-dev mailing list