On Thu 18 May 2017 06:54, Jan Nieuwenhuizen <[email protected]> writes:
>> This is the right thing:
>>
>> (define-module (foo) #:export (baz))
>> (define eval-module (current-module))
>> (define bar 42)
>> (define (baz) (eval 'bar eval-module))
>
> Thanks!...this works. I'm very happy with this, it means that I can
> create an sexp-object format, yay!
>
> Earlier I tried several things eval, but did not see this `define
> eval-module' coming. The above works, this does not work
>
> (define-module (foo) #:export (baz))
> (define bar 42)
> (define (baz) (eval 'bar (current-module)))
current-module is dynamically scoped. Consider:
(define-module (qux)
#:use-module (foo))
(baz)
In this case the current module for the baz invocation is (qux).
Andy