[Python-ideas] Idea: Compressing the stack on the fly

Guido van Rossum guido at python.org
Mon May 27 07:14:33 CEST 2013


On Sun, May 26, 2013 at 10:01 PM, Stephen J. Turnbull
<stephen at xemacs.org> wrote:
> IOW, I doubt that Guido would explicitly veto contribution of a more
> efficient tail recursion as long as programs using it are equally
> debuggable, and the implementation not so complex as to invite lots of
> maintenance in the future.  I suppose he just wants to encourage
> people to spend their available effort on more Pythonic lines of
> development.

Actually (as you can read in the blog:
http://neopythonic.blogspot.com/2009/04/tail-recursion-elimination.html)
I would seriously frown upon that if it was a patch to CPython only.
Tail recursion elimination needs to be addressed at the language
level, not as an implementation trick.

As to the OP's idea of applying compression to the stack, well, it
definitely sounds novel and probably untried, and I recommend trying
it in another language than Python first to see if it can be done
efficiently at all. One issue is that there's actually quite a bit
more on the stack than just the value of local variables, and all that
needs to be taken into account. The first place where I would look for
ideas is the work done on backwards execution -- I've never used or
understood such systems, but I presume they must have some way of
handling the stack, too.

-- 
--Guido van Rossum (python.org/~guido)


More information about the Python-ideas mailing list