unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Andy Wingo <wingo@pobox.com>
To: Nala Ginrut <nalaginrut@gmail.com>
Cc: guile-devel <guile-devel@gnu.org>
Subject: Re: Can't get outside bindings in the string expression with eval-string
Date: Tue, 18 Oct 2011 16:59:32 +0200	[thread overview]
Message-ID: <87ipnm8hwr.fsf@pobox.com> (raw)
In-Reply-To: <CAPjoZofbf_+mM7jbE=Vq28sHFK3n5X70VVehbw86DUj0dzHQQg@mail.gmail.com> (Nala Ginrut's message of "Tue, 18 Oct 2011 22:32:14 +0800")

On Tue 18 Oct 2011 16:32, Nala Ginrut <nalaginrut@gmail.com> 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/



  parent reply	other threads:[~2011-10-18 14:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
     [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=87ipnm8hwr.fsf@pobox.com \
    --to=wingo@pobox.com \
    --cc=guile-devel@gnu.org \
    --cc=nalaginrut@gmail.com \
    /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).