|There's more than one way to do things|
Re: Pure Perl tail call optimizationby abstracts (Hermit)
|on Apr 26, 2002 at 06:54 UTC||Need Help??|
Another note (hope I haven't bothered you enough yet :-))
Last time I checked with the Parrot docs (the tutorial mainly), there was no mention of jumps to computed values (which is what you said you need for implementing call/cc). So the question is: how can one do proper tail recursion without jumps? (Parrot does have jump LABEL though)
Another question is: if your C compiler doesn't do proper tail recursion (C compilers are not required to), then can you still do proper tail recursion in C?
Just for the record, here is the definition of proper tail recursion according to the Scheme Revised^5 Report:
Implementations of Scheme are required to be properly tail-recursive. ... . A Scheme implementation is properly tail-recursive if it supports an unbounded number of active tail calls. A call is active if the called procedure may still return.
I don't think scheme implementations are required to support call/cc, but they are required to support proper tail recursion.
The reason I'm blabbering about this is that I just finished a course in compilers where we implemented a good subset of scheme. The compiler translates scheme to Sparc assembly code, and at some time we targeted C. So, I know proper tail recursion is possible, even in VB :-).
Update: Thanks Elian for the reply. I guess the docs might be out of date since development there is going very fast.