David Kastrup <d...@gnu.org> writes: > Mark H Weaver <m...@netris.org> writes: > >> Indeed, (local-eval '(set! x 5) <env>) is _not_ equivalent to >> (module-set! (current-module) 'x 5). > > To clarify: I was thinking about > > (local-eval '(set! x 5) <env>) vs > (local-eval '(module-set! (current-module) 'x 5) <env>) > >> Assuming that `x' is not locally bound within the captured lexical >> environment, the first sets `x' in the module captured by >> (the-environment), i.e. the module where `x' would have been set if you >> had put (set! x 5) in place of (the-environment). The second sets `x' >> in the (current-module) at the time of evaluation. > > Yes, that would be what I would expect given the two local-eval calls > above.
Let me check with my "reference hack" on Guilev1: (define (my-eval form env) (call-with-current-continuation (lambda (x) (env (list x form))))) (define-macro (my-env) (call-with-current-continuation identity)) (display (save-module-excursion (lambda () (let ((env (my-env))) (set-current-module (resolve-module '(none))) (my-eval '(current-module) env))))) => #<directory (none) b786d380> Even that agrees. Not that I would be eager to analyze why. -- David Kastrup