Mark H Weaver <m...@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