[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Eval, tail calls, (current-module), and backward compatibility

From: David Kastrup
Subject: Re: Eval, tail calls, (current-module), and backward compatibility
Date: Tue, 17 Jan 2012 12:02:37 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux)

Mark H Weaver <address@hidden> 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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]