Keyword order in Smalltalk

Dan Ingalls Dan.Ingalls at disney.com
Thu Aug 12 01:17:54 UTC 1999


Stephen Pope <stp at create.ucsb.edu> wrote...
>I was just talking to a colleague who's a Java programmer interested in
>Smalltalk, and I could not come up with a meaningful example of when
>keyword order really matters in a method body. (It can of course matter
>in what order you compute the arguments in the calling method, in case
>the preparation of one argument has side-effects that influence the
>value of another method.) 

(But it is beyond-poor style to do this, since another engine may well want to evaluate the args in the other order ;-)

>Apart from the obvious faster method lookup, why *should* Smalltalk
>treat two methods with the same keywords but different keyword order as
>unique methods?

Not even necessarily any faster.

The original keyword syntax in ST-76 was designed to support arbitrary ordering.  We dropped it because of browsability problems.  You don't know where to look for the method, and things just get really cluttered if you allow all permutations.  If only one order works, then you LEARN that order, and things are easy (er) to find.

Hope this helps

	- Dan





More information about the Squeak-dev mailing list