From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Nala Ginrut Newsgroups: gmane.lisp.guile.devel Subject: Re: Can't get outside bindings in the string expression with eval-string Date: Wed, 19 Oct 2011 10:22:22 +0800 Message-ID: References: <87ipnm8hwr.fsf@pobox.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=20cf303bfbde9ba4e904af9d82d7 X-Trace: dough.gmane.org 1318990954 30518 80.91.229.12 (19 Oct 2011 02:22:34 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 19 Oct 2011 02:22:34 +0000 (UTC) To: guile-devel Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Wed Oct 19 04:22:30 2011 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1RGLnZ-0004nZ-HC for guile-devel@m.gmane.org; Wed, 19 Oct 2011 04:22:29 +0200 Original-Received: from localhost ([::1]:36691 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RGLnY-0004oB-Hr for guile-devel@m.gmane.org; Tue, 18 Oct 2011 22:22:28 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:35112) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RGLnV-0004o3-DR for guile-devel@gnu.org; Tue, 18 Oct 2011 22:22:26 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RGLnT-00048r-Rw for guile-devel@gnu.org; Tue, 18 Oct 2011 22:22:25 -0400 Original-Received: from mail-iy0-f169.google.com ([209.85.210.169]:37192) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RGLnT-00048n-JR for guile-devel@gnu.org; Tue, 18 Oct 2011 22:22:23 -0400 Original-Received: by iagf6 with SMTP id f6so1742508iag.0 for ; Tue, 18 Oct 2011 19:22:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=zSZ3XoaWTvqDczd46BRB/DP26VvyMnwyPuQF8wrWIe0=; b=RBSKrdaQbgwnYPQqj22BQ4F/1e51CW4ToicRDHWKJx2JrQO4gXhJqmqov7YDk/mzM2 fKwGcUe1mdMdmfWZevTa1EcQR03fTsJIrxARq2IuNmkrd/hPQBDobzAM7FVdCm8Jny5W eKB1QM5hj+D4NiG+jKvUPmyezsUMmSx70zkKI= Original-Received: by 10.42.197.197 with SMTP id el5mr8721139icb.23.1318990942807; Tue, 18 Oct 2011 19:22:22 -0700 (PDT) Original-Received: by 10.43.132.133 with HTTP; Tue, 18 Oct 2011 19:22:22 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 209.85.210.169 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:12847 Archived-At: --20cf303bfbde9ba4e904af9d82d7 Content-Type: text/plain; charset=UTF-8 On Tue, Oct 18, 2011 at 10:59 PM, Andy Wingo wrote: > On Tue 18 Oct 2011 16:32, Nala Ginrut 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. --20cf303bfbde9ba4e904af9d82d7 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
On Tue, Oct 18, 2011 at 10:59 PM, Andy Wingo <wingo@pobox.com> wrote:
On Tue 18 Oct 2011 16:32, Nala Ginrut <nalaginrut@gmail.com> writes:

> -----------------------wrong code------------------------------
> (define (func)
> =C2=A0 =C2=A0(let ((fp (open-output-file "/tmp/aaa")))
> =C2=A0 =C2=A0 =C2=A0 =C2=A0(eval-string "(write 123 fp)" (cu= rrent-module))
> =C2=A0 =C2=A0 ))
> -----------------------end code------------------------------------
`fp' is a lexical binding, not a module-level binding. =C2=A0So n= o, this
won't work. =C2=A0You won't be able to get to lexical variables via= `eval'
(or `eval-string').

Andy
--
http://wingolog.org/=


OK, I'll = try another approach.

--20cf303bfbde9ba4e904af9d82d7--