From: Nala Ginrut <nalaginrut@gmail.com>
To: guile-devel <guile-devel@gnu.org>
Subject: Can't get outside bindings in the string expression with eval-string
Date: Tue, 18 Oct 2011 22:32:14 +0800 [thread overview]
Message-ID: <CAPjoZofbf_+mM7jbE=Vq28sHFK3n5X70VVehbw86DUj0dzHQQg@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 882 bytes --]
hi guys, I want to get a variable bidden from outside environment, such as
the code below:
-----------------------correct code------------------------
(define fp (open-output-file "/tmp/aaa"))
(eval-string "(write 123 fp)" (current-module))
-------------------------end----------------------------------
This code can run successfully.
But I want to use this trick in a procedure:
-----------------------wrong code------------------------------
(define (func)
(let ((fp (open-output-file "/tmp/aaa")))
(eval-string "(write 123 fp)" (current-module))
))
-----------------------end code------------------------------------
Guile will throw :
========================================
scheme@(guile-user)> (func)
ERROR: In procedure memoize-variable-access!:
ERROR: Unbound variable: fp0
========================================
Is this a bug? Or I missed something?
[-- Attachment #2: Type: text/html, Size: 1233 bytes --]
next reply other threads:[~2011-10-18 14:32 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-18 14:32 Nala Ginrut [this message]
2011-10-18 14:42 ` Can't get outside bindings in the string expression with eval-string Nala Ginrut
2011-10-18 14:59 ` Andy Wingo
[not found] ` <CAPjoZoeUQ7aokEUzeQ1f+Ge1zPOkEQcLgwdTiC5YJtDRR2hrqg@mail.gmail.com>
2011-10-19 2:22 ` Nala Ginrut
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='CAPjoZofbf_+mM7jbE=Vq28sHFK3n5X70VVehbw86DUj0dzHQQg@mail.gmail.com' \
--to=nalaginrut@gmail.com \
--cc=guile-devel@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).