Is Squeak tail recursive?

Dan Ingalls DanI at wdi.disney.com
Fri Jan 29 19:06:21 UTC 1999


amoroso at mclink.it (Paolo Amoroso) wrote...
>Does the Squeak compiler generate properly tail recursive code?

No, but the show ain't over yet.

What the Squeak compiler does or doesn't do should become much less of an issue as we move toward dynamic translation.  There you have much greater command of run-time structures, concrete type information, and the freedom to cheat left and right (as long as you don't get caught ;-).  In some sense the destiny of the visible Squeak compiler is probably to become as simple and NON optimized as possible (there are also some truly beautiful things that become possible when, eg, ifTrue: gets sent as a real message, but that's another story...).

I don't think Jitter 2 will do tail recursion at first release but, modulo the problems already mentioned, it's a clear possibility.

Incidentally, I still remember a really cogent point made by James McCartney two years ago (3/14/97) on this list -- namely that a similar and generally more practical optimization is redirection with the same arguments.

For instance...
at: index
   ^ self basicAt: index
or...
displayOn: aMedium
   ^ myImage displayOn: aMedium

It's the same territory -- situations where the proper context is all set up, and you can just move in without having to build a whole new house.  James actually does this in his SuperCollider system.

	- Dan





More information about the Squeak-dev mailing list