From: Daniel Colascione <dancol@dancol.org>
To: Chris Gray <chrismgray@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: tail-call elimination
Date: Mon, 10 Dec 2012 22:13:37 -0800 [thread overview]
Message-ID: <50C6CF11.2000706@dancol.org> (raw)
In-Reply-To: <CAK1AjMTeCb9youwGygrrOPPzcK0iL8r-yF7QL1ifT-QQUO3NgQ@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 857 bytes --]
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.
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 258 bytes --]
next prev parent reply other threads:[~2012-12-11 6:13 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-11 2:57 tail-call elimination Chris Gray
2012-12-11 3:17 ` Stefan Monnier
2012-12-11 6:13 ` Daniel Colascione [this message]
2012-12-11 6:45 ` Chris Gray
2012-12-11 13:34 ` Stefan Monnier
2012-12-11 14:30 ` Wolfgang Jenkner
2012-12-11 15:13 ` Stefan Monnier
2012-12-31 18:16 ` Chris Gray
2013-01-07 18:28 ` Stefan Monnier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=50C6CF11.2000706@dancol.org \
--to=dancol@dancol.org \
--cc=chrismgray@gmail.com \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).