guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Can't get outside bindings in the string expression with eval-string


From: Nala Ginrut
Subject: Can't get outside bindings in the string expression with eval-string
Date: Tue, 18 Oct 2011 22:32:14 +0800

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?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]