From: David Kastrup <dak@gnu.org>
To: guile-devel@gnu.org
Subject: Re: Eval, tail calls, (current-module), and backward compatibility
Date: Tue, 17 Jan 2012 12:02:37 +0100 [thread overview]
Message-ID: <878vl6twvm.fsf@fencepost.gnu.org> (raw)
In-Reply-To: 87lip70zz7.fsf@netris.org
Mark H Weaver <mhw@netris.org> writes:
> (current-module) should be relevant only at the beginning of
> macro-expansion: before any program transformations are performed,
> (current-module) is "baked" into every symbol of the top-level form.
> (psyntax actually does this lazily, but the effect is the same).
>
> After that, (current-module) should be completely irrelevant to the rest
> of compilation and evaluation.
It isn't if you call it in the code. Personally, I am not sure that it
should reflect the second argument of eval if that is different from the
current module in which eval has been called.
Does R5RS have an opinion on modules and eval?
> Ideally, I think that `eval' should set (current-module) during
> expansion, but _not_ during evaluation. Then it can be properly tail
> recursive. However, some code out there might depend on the existing
> behavior, so I guess we can't change this, at least not in 2.0.
> Bummer.
I am not sure. If you rebind current-module itself during expansion,
you might be able to retain the currently visible behavior while being
in tail-call position during execution. Of course, if any user meddles
with the value of current-module other than just calling it, he is going
to be in for surprises.
--
David Kastrup
next prev parent reply other threads:[~2012-01-17 11:02 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-17 3:28 Eval, tail calls, (current-module), and backward compatibility Mark H Weaver
2012-01-17 11:02 ` David Kastrup [this message]
2012-01-17 21:02 ` Mark H Weaver
2012-01-18 9:36 ` Andy Wingo
2012-01-18 19:58 ` Mark H Weaver
2012-01-18 21:52 ` Andy Wingo
2012-01-18 21:18 ` Ludovic Courtès
2012-01-18 22:01 ` Andy Wingo
2012-01-18 22:21 ` Ludovic Courtès
2012-01-18 22:27 ` Andy Wingo
2012-01-18 22:47 ` Ludovic Courtès
2012-01-18 22:56 ` Andy Wingo
2012-01-21 15:59 ` David Kastrup
2012-01-21 18:28 ` Mark H Weaver
2012-01-21 18:33 ` David Kastrup
2012-01-21 19:06 ` Mark H Weaver
2012-01-23 10:41 ` Andy Wingo
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/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=878vl6twvm.fsf@fencepost.gnu.org \
--to=dak@gnu.org \
--cc=guile-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.
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).