[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: primitive eval with module => Unbound variable?
From: |
Andy Wingo |
Subject: |
Re: primitive eval with module => Unbound variable? |
Date: |
Mon, 22 May 2017 21:45:17 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) |
On Thu 18 May 2017 06:54, Jan Nieuwenhuizen <address@hidden> 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