About KCP and automatic initialize

goran.krampe at bluefish.se goran.krampe at bluefish.se
Tue Sep 16 15:06:14 UTC 2003


"Andreas Raab" <andreas.raab at gmx.de> wrote:
[SNIP]
> It would be trivial with a tiniest bit of modification to the language
> itself, merely by providing an attribute to an instance side method which
> signifies this as a "constructor message" and simply compiles the
> appropriate class-side method, e.g., something like (using "+" as the
> "constructor message flag")
> 
> +initializeWithFoo: aFoo bar: aBar
> 	myFoo := aFoo.
> 	myBar := aBar.
> 
> could simply compile a class-side method which is
> 
> MyClass class>>initializeWithFoo: aFoo bar: aBar
> 	^super new initializeWithFoo: aFoo bar: aBar

Hmmm. Sortof syntactic sugar for constructors. Ok, before people start
shouting - what other consequences could this have? For example, what if
we remove +initializeWithFoo:bar:? Do we then automatically remove the
class side method? We could if we offer a confirm-dialog for that.

But wait, wouldn't it be better with:

	MyClass class>>foo: aFoo bar: aBar
 		^super new initializeWithFoo: aFoo bar: aBar

Anyway, that's a detail. Hmmm...

Without taking a side regarding this little "sneaked in" proposal yet -
I personally *really* think we should take the "lead" and move Squeak
forward. Sure, Squeak started as a Smalltalk-80 clone - but that doesn't
mean IMHO that it needs to end as one too.

As long as we make sure we keep track of these things that makes Squeak
different - I am all for innovation (oops, that almost made me sound
like Bill Gates...).

regards, Göran

PS. We could insert these "language changes" in a release with the
intent of evaluating it and then see if it works out etc. For example,
if we add the above in 3.7 we could easily wait with some kind of "final
decision" on it until 3.8.



More information about the Squeak-dev mailing list