From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andy Wingo Newsgroups: gmane.lisp.guile.devel Subject: Re: [PATCH] Implement local-eval, local-compile, and the-environment Date: Sat, 14 Jan 2012 16:58:54 +0100 Message-ID: <874nvyuvgh.fsf@pobox.com> References: <87d3b1hxcw.fsf@netris.org> <87boqfgzx5.fsf@pobox.com> <87y5tj6z86.fsf@netris.org> <8739brgqbr.fsf@pobox.com> <8762gm6i9j.fsf@netris.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1326556750 7040 80.91.229.12 (14 Jan 2012 15:59:10 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 14 Jan 2012 15:59:10 +0000 (UTC) Cc: guile-devel@gnu.org To: Mark H Weaver Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Sat Jan 14 16:59:05 2012 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 1Rm60W-0007QB-CL for guile-devel@m.gmane.org; Sat, 14 Jan 2012 16:59:04 +0100 Original-Received: from localhost ([::1]:41744 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rm60W-00022v-1L for guile-devel@m.gmane.org; Sat, 14 Jan 2012 10:59:04 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:41017) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rm60T-00022k-9L for guile-devel@gnu.org; Sat, 14 Jan 2012 10:59:02 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rm60S-00062Q-2B for guile-devel@gnu.org; Sat, 14 Jan 2012 10:59:01 -0500 Original-Received: from a-pb-sasl-sd.pobox.com ([74.115.168.62]:33978 helo=sasl.smtp.pobox.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rm60R-00062M-Tc for guile-devel@gnu.org; Sat, 14 Jan 2012 10:59:00 -0500 Original-Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-sd.pobox.com (Postfix) with ESMTP id 5CFED71D3; Sat, 14 Jan 2012 10:58:59 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=sasl; bh=m4SlP9ZLgqXecr8PxGC2eSZtp3Q=; b=dY4jfP al3BqyYcIs8gecqqRbCHO99tJHtz6ePABnCcvDcb5QCJsChp51X52xAHG7dHr3Al lgwGB1S8wQ4mS6RwezwuA6juuFd6PBSkzlL6J+aXO6+9qnm2569SosWbpRRseLo5 4ZEk5jiYvHJT1EfIDdb0OfZyHWD7zRDz4jEns= DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; q=dns; s=sasl; b=KIYYpEmcEW2MtrGn+o0UhpyZjAmUyb6u 1uIxFB9qnuChAXDP1mIn/XUPRlzWAJ3STnuyQDAODUt9m16H5uEe14A1Ze27f23Q kvxUT3hibewM6NGMnTX/hSB+kL300e4F1KMPat2bkXlmv1zNvEpEC3hL2NWuvGZZ Mtq9Psl0vHA= Original-Received: from a-pb-sasl-sd.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-sd.pobox.com (Postfix) with ESMTP id 564DD71D2; Sat, 14 Jan 2012 10:58:59 -0500 (EST) Original-Received: from badger (unknown [90.164.198.39]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by a-pb-sasl-sd.pobox.com (Postfix) with ESMTPSA id 9306071D1; Sat, 14 Jan 2012 10:58:58 -0500 (EST) In-Reply-To: <8762gm6i9j.fsf@netris.org> (Mark H. Weaver's message of "Sun, 08 Jan 2012 15:39:36 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) X-Pobox-Relay-ID: AB61444C-3EC8-11E1-8E23-65B1DE995924-02397024!a-pb-sasl-sd.pobox.com X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) X-Received-From: 74.115.168.62 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:13496 Archived-At: Hi Mark, On Sun 08 Jan 2012 21:39, Mark H Weaver writes: > Andy Wingo writes: >> I guess it's not clear to me why you would want to force expression >> context. > > If we allow definitions, then your nice equivalence > >
== (local-eval ' (the-environment)) > > no longer holds. Also, the user cannot use the simple mental model of > imagining that had been put in place of (the-environment). > > For example: > > (let ((x 1)) > (define (get-x) x) > (begin > (define x 2) > (get-x))) > => 2 > > is _not_ equivalent to: > > (let ((x 1)) > (define (get-x) x) > (local-eval '(begin > (define x 2) > (get-x)) > (the-environment))) > => 1 > > The only way I see to achieve your equivalence is to constrain to > be an expression. Ahh, yes indeed. Thanks for the example. Another (less clear) way to say this would be to note that it's not possibly to incrementally build up a set of recursive bindings. Or, another try: local-eval cannot be allowed to affect the resolution of variables already in the environment. Therefore it does not capture an open set of mutually recursive bindings. I'm not doing very well at describing it, but your example was very good. What about the-environment outside of a lexical contour, though? Does that permit definitions? Should it? Andy -- http://wingolog.org/