[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: tail-call elimination
From: |
Daniel Colascione |
Subject: |
Re: tail-call elimination |
Date: |
Mon, 10 Dec 2012 22:13:37 -0800 |
User-agent: |
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:16.0) Gecko/20121026 Thunderbird/16.0.2 |
On 12/10/2012 6:57 PM, Chris Gray wrote:
> Hello,
>
> I have attached a patch that implements tail-call elimination for a subset of
> emacs lisp. This will be helpful in allowing coding styles which emphasize
> tail
> recursion, such as is usual in languages like Scheme.
Your patch eliminates tail calls only in byte compiled code. Until the
interpreter also supports guaranteed tail call elimination or we byte-compile
all forms before evaluating them, elisp developers cannot rely on the
optimization and cannot write idiomatic tail recursive code. As a purely
opportunistic optimization, not as a guaranteed language feature, I doubt tail
call elimination is worth the complexity.
I also don't particularly like code that relies on tail call elimination. I find
it difficult to read, and as you note, the results can be surprising.
signature.asc
Description: OpenPGP digital signature