unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* Can't get outside bindings in the string expression with eval-string
@ 2011-10-18 14:32 Nala Ginrut
  2011-10-18 14:42 ` Nala Ginrut
  2011-10-18 14:59 ` Andy Wingo
  0 siblings, 2 replies; 4+ messages in thread
From: Nala Ginrut @ 2011-10-18 14:32 UTC (permalink / raw)
  To: guile-devel

[-- 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 --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-10-19  2:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-18 14:32 Can't get outside bindings in the string expression with eval-string Nala Ginrut
2011-10-18 14:42 ` Nala Ginrut
2011-10-18 14:59 ` Andy Wingo
     [not found]   ` <CAPjoZoeUQ7aokEUzeQ1f+Ge1zPOkEQcLgwdTiC5YJtDRR2hrqg@mail.gmail.com>
2011-10-19  2:22     ` Nala Ginrut

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).