From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Hans Aberg Newsgroups: gmane.lisp.guile.devel Subject: Re: [PATCH] Implement `the-environment' and `local-eval' in evaluator Date: Fri, 16 Dec 2011 17:59:13 +0100 Message-ID: <748F1A2B-B0AF-4646-B982-664014995E88@telia.com> References: <87liqtpsl9.fsf@fencepost.gnu.org> <87wra1hcek.fsf@netris.org> <87mxaxihnw.fsf@pobox.com> <87obvclu92.fsf@fencepost.gnu.org> <87aa6wbp0w.fsf@pobox.com> <87fwgolgm5.fsf@fencepost.gnu.org> <8762hkbkwi.fsf@pobox.com> <87borclcem.fsf@fencepost.gnu.org> <87zkewa2vy.fsf@pobox.com> <87zkewjvyz.fsf@fencepost.gnu.org> <87vcpka13n.fsf@pobox.com> <87zkewnzy7.fsf@netris.org> <87r5089ui3.fsf@pobox.com> <87r508nv0o.fsf@netris.org> <87fwgondme.fsf@netris.org> <87borboalb.fsf@netris.org> <877h1zo7xx.fsf_-_@netris.org> <8762hgkh2k.fsf_-_@netris.org> <8762hg50b3.fsf@fencepost.gnu.org> <87obv8iljr.fsf@netris.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 (Apple Message framework v1251.1) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1324054786 16417 80.91.229.12 (16 Dec 2011 16:59:46 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 16 Dec 2011 16:59:46 +0000 (UTC) Cc: Peter TB Brett , guile-devel@gnu.org To: Mark H Weaver Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Fri Dec 16 17:59:42 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 1Rbb8H-0004YY-OO for guile-devel@m.gmane.org; Fri, 16 Dec 2011 17:59:41 +0100 Original-Received: from localhost ([::1]:37177 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rbb8H-0005IU-5L for guile-devel@m.gmane.org; Fri, 16 Dec 2011 11:59:41 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:59710) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rbb8A-0005I9-PH for guile-devel@gnu.org; Fri, 16 Dec 2011 11:59:38 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rbb85-0006YV-5I for guile-devel@gnu.org; Fri, 16 Dec 2011 11:59:34 -0500 Original-Received: from smtp-out12.han.skanova.net ([195.67.226.212]:58504) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rbb84-0006YA-Mw for guile-devel@gnu.org; Fri, 16 Dec 2011 11:59:29 -0500 Original-Received: from [10.0.1.2] (217.210.127.13) by smtp-out12.han.skanova.net (8.5.133) (authenticated as u26619196) id 4ECF62B40063FABC; Fri, 16 Dec 2011 17:59:14 +0100 In-Reply-To: <87obv8iljr.fsf@netris.org> X-Mailer: Apple Mail (2.1251.1) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 195.67.226.212 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:13144 Archived-At: On 16 Dec 2011, at 16:27, Mark H Weaver wrote: > As an interesting case, suppose that you define the following macro in > module A: >=20 > (define foo 'module-a) > (define-syntax alt-environment > (syntax-rules () > ((_) (the-environment)))) >=20 > and then evaluate the following within module B: >=20 > (define foo 'module-b) > (local-eval 'foo (alt-environment)) >=20 > What should the result be? >=20 > My guess is that it should return 'module-a, because I think > conceptually it should act as though the local-expression passed to > `local-eval' were put in place of (the-environment), wherever that > might be. >=20 > Thoughts? I thought it should be a way to capture the environment when = (the-environment) is evaluated, returning a reference to it. So (define foo 'module-a) (define bar (the-environment)) ; Capture environment, and save = reference in bar. Now in (define foo 'module-b) (local-eval 'foo bar) bar refers to the captured environment and 'foo is inserted into that; = that is 'module-a. It would need to capture all dynamic syntactic rules as well, otherwise = the code cannot be run safely. Hans