guile-devel
[Top][All Lists]
Advanced

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

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


From: Nala Ginrut
Subject: Re: Can't get outside bindings in the string expression with eval-string
Date: Wed, 19 Oct 2011 10:22:22 +0800

On Tue, Oct 18, 2011 at 10:59 PM, Andy Wingo <address@hidden> wrote:
On Tue 18 Oct 2011 16:32, Nala Ginrut <address@hidden> writes:

> -----------------------wrong code------------------------------
> (define (func)
>    (let ((fp (open-output-file "/tmp/aaa")))
>        (eval-string "(write 123 fp)" (current-module))
>     ))
> -----------------------end code------------------------------------

`fp' is a lexical binding, not a module-level binding.  So no, this
won't work.  You won't be able to get to lexical variables via `eval'
(or `eval-string').

Andy
--
http://wingolog.org/


OK, I'll try another approach.


reply via email to

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