[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: tail recursion proposal
It seems a shame not to use Guy's humorous definition of tail pessimization
(along with Kent's modification) in the write-up for the requirement of proper
tail-recursion. It points out the tradeoff while nicely conveying the spirit of
scheme's proper tail-recursion requirement.
"The effective substitution of some other continuation k2 for the continuation
k in the call to p1 is called <I>tail call pessimization</I>. This is an
extremely detrimental pessimization because it effectively prevents the use of
tail calls to implement iteration, a widely used and well-loved programming
idiom in the Scheme language [that defeats the widely used and well-loved
program idiom of stack debugging common to other languages]. Tail call
pessimization will cause an iteration so programmed to accumulate unnecessary
continuations; informally, they will unnecessarily ``consume stack''.
Implementations of Scheme are required to reliably detect function calls from a
tail position and to avoid tail call pessimization."