Re: Was not making tail recursion elmination a mistake?

From: Svein Ove Aas (svein+usenet01_at_brage.info)
Date: 06/11/04


Date: Fri, 11 Jun 2004 21:08:33 +0200

Pascal Costanza wrote:

>
> John Thingstad wrote:
>
>> I have recently been annoyeed by the fact that tail recursion
>> elimination is
>> not part of the standard. Any ansi compliant program can now not rely
>> on recurive tail
>> elimination and must use loops or some simular structue. For mutual
>> recurion things get even uglier.
>> Wouldn't it have been better to make a commentary on the implementation
>> and require it?
>> Most implementations do anyhow.
>> What is the historic reason for this omission?
>
> There are situations in which it is better not to eliminate tail
> recursions (better debuggability, more restart options), so it would
> have been an optional feature. The ANSI standard generally doesn't cover
> optional features (or so it seems to me).
>
It seems to me that you could make it an obligatory feature that has an
option to be turned off by the programmer.

Tail-call elimination isn't exactly hard to do, is it?



Relevant Pages

  • Re: The benefits of recursive programming
    ... >>> Where tail call elimination is possible it is already so simple you ... >> Tail recursion is always possible but not always easy. ... >> try to write a tail recursive ackermann or fibonacci function off the ...
    (comp.programming)
  • Re: CAS, Lambda Calculus, Continuation and Functional Programming
    ... >>that makes tail call elimination less attractive for compiler writers. ... > I don't know why exception handling should prevent tail-call ... so a local array would be best (in languages ...
    (sci.math.symbolic)
  • Re: Iteration in lisp
    ... Nearly all compilers seem to do tail call elimination ... My remarks were directed not any user making a properly informed ... Common Lisp, I generally mean "any Common Lisp"; when I want to talk about ...
    (comp.lang.lisp)
  • Mandatory tail call elimination (was: Needed features in upcoming standards to support VMs & lan
    ... Note that I've never written more than a toy compiler, ... Do anyone know of a language with mandatory tail call elimination but no ... An ordinary function call never has _TailCall semantics. ...
    (comp.std.c)
  • Re: Iteration in lisp
    ... recursive function can run out of stack since CL does not guarantee ... In the absence of guaranteed tail call elimination, ...
    (comp.lang.lisp)

Loading