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: Can't get outside bindings in the string expression with eval-string Date: Tue, 18 Oct 2011 22:32:14 +0800 Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=90e6ba6e8342fba68004af9396ef X-Trace: dough.gmane.org 1318948345 20844 80.91.229.12 (18 Oct 2011 14:32:25 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 18 Oct 2011 14:32:25 +0000 (UTC) To: guile-devel Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Tue Oct 18 16:32:21 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 1RGAiK-0003e6-Fx for guile-devel@m.gmane.org; Tue, 18 Oct 2011 16:32:20 +0200 Original-Received: from localhost ([::1]:53645 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RGAiJ-0003IW-KQ for guile-devel@m.gmane.org; Tue, 18 Oct 2011 10:32:19 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:44791) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RGAiG-0003HU-U2 for guile-devel@gnu.org; Tue, 18 Oct 2011 10:32:18 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RGAiF-0001Nu-Pi for guile-devel@gnu.org; Tue, 18 Oct 2011 10:32:16 -0400 Original-Received: from mail-yx0-f169.google.com ([209.85.213.169]:53480) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RGAiF-0001Nq-Lq for guile-devel@gnu.org; Tue, 18 Oct 2011 10:32:15 -0400 Original-Received: by yxs7 with SMTP id 7so801590yxs.0 for ; Tue, 18 Oct 2011 07:32:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; bh=KDSPpLa2rAGRkr3h548uBHxhCmpXU9Gh5ldGSvhiORM=; b=WTTxIdNWJdPMnvHV4QxEqxwiMiTVRURLb4PM5XccynqkRXMrtUsgsW1Aa0o/7D9uOA k+uJMBmU0xP3yuGhzLBe7UbcgkyE2QNcym/Efi1nu7YCPd9WHvY1uSWppauBYG+BWOo1 BqRi25vkeF0XZZsarLgd1zoEQO/eEleigju0I= Original-Received: by 10.42.172.194 with SMTP id o2mr5226651icz.15.1318948334970; Tue, 18 Oct 2011 07:32:14 -0700 (PDT) Original-Received: by 10.43.132.133 with HTTP; Tue, 18 Oct 2011 07:32:14 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 209.85.213.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:12843 Archived-At: --90e6ba6e8342fba68004af9396ef Content-Type: text/plain; charset=UTF-8 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? --90e6ba6e8342fba68004af9396ef Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
hi guys, I want to get a variable=C2=A0bidden from outside environment= , such as the code below:=C2=A0

------------------= -----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 t= o use this trick in a procedure:
-----------------------wrong code------------------------------
<= div>(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)" (current-module))
=C2=A0 =C2=A0 ))
-----------------------end code------------= ------------------------

Guile will throw :
<= div>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
scheme@(= guile-user)> (func)
ERROR: In procedure memoize-variable-access!:
ERROR: Unbound= variable: fp0
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D

Is this a bug? Or I missed something?

--90e6ba6e8342fba68004af9396ef--