From: Andy Wingo <wingo@pobox.com>
To: Jan Nieuwenhuizen <janneke@gnu.org>
Cc: guile-user@gnu.org
Subject: Re: primitive eval with module => Unbound variable?
Date: Mon, 22 May 2017 21:45:17 +0200 [thread overview]
Message-ID: <87shjw3cc2.fsf@pobox.com> (raw)
In-Reply-To: <87shk24vdo.fsf@gnu.org> (Jan Nieuwenhuizen's message of "Thu, 18 May 2017 06:54:59 +0200")
On Thu 18 May 2017 06:54, Jan Nieuwenhuizen <janneke@gnu.org> 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
next prev parent reply other threads:[~2017-05-22 19:45 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-16 21:59 primitive eval with module => Unbound variable? Jan Nieuwenhuizen
2017-05-17 17:58 ` Vladimir Zhbanov
2017-05-17 19:44 ` Andy Wingo
2017-05-18 4:54 ` Jan Nieuwenhuizen
2017-05-22 19:45 ` Andy Wingo [this message]
2017-05-22 20:19 ` Jan Nieuwenhuizen
2017-05-22 19:48 ` Andy Wingo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87shjw3cc2.fsf@pobox.com \
--to=wingo@pobox.com \
--cc=guile-user@gnu.org \
--cc=janneke@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).