From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Neil Jerram Newsgroups: gmane.lisp.guile.devel Subject: Re: [patch] variable datums with syncase transformer Date: Wed, 05 Mar 2008 20:55:33 +0000 Message-ID: <87lk4wao1m.fsf@ossau.uklinux.net> References: <1197619616.5218.34.camel@nocandy.dyndns.org> <87y78xqgdp.fsf@gnu.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1204750612 26428 80.91.229.12 (5 Mar 2008 20:56:52 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 5 Mar 2008 20:56:52 +0000 (UTC) Cc: guile-devel@gnu.org To: ludo@gnu.org (Ludovic =?iso-8859-1?Q?Court=E8s?=) Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Wed Mar 05 21:57:15 2008 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1JX0fZ-0006XV-Kc for guile-devel@m.gmane.org; Wed, 05 Mar 2008 21:56:57 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JX0f2-0000Xe-AX for guile-devel@m.gmane.org; Wed, 05 Mar 2008 15:56:24 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JX0eK-00005p-CL for guile-devel@gnu.org; Wed, 05 Mar 2008 15:55:40 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JX0eJ-00005S-Lf for guile-devel@gnu.org; Wed, 05 Mar 2008 15:55:39 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JX0eJ-00005M-Dc for guile-devel@gnu.org; Wed, 05 Mar 2008 15:55:39 -0500 Original-Received: from mail3.uklinux.net ([80.84.72.33]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JX0eF-00032S-1t; Wed, 05 Mar 2008 15:55:35 -0500 Original-Received: from arudy (host86-145-183-175.range86-145.btcentralplus.com [86.145.183.175]) by mail3.uklinux.net (Postfix) with ESMTP id 1E6C11F692C; Wed, 5 Mar 2008 20:55:34 +0000 (GMT) Original-Received: from laruns (laruns [192.168.0.10]) by arudy (Postfix) with ESMTP id 6A2CA3800A; Wed, 5 Mar 2008 20:55:33 +0000 (GMT) In-Reply-To: <87y78xqgdp.fsf@gnu.org> (Ludovic =?iso-8859-1?Q?Court=E8s's?= message of "Wed, 05 Mar 2008 17:34:26 +0100") User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux) X-detected-kernel: by monty-python.gnu.org: Linux 2.4-2.6 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:7061 Archived-At: ludo@gnu.org (Ludovic Court=E8s) writes: > Note that `@' and `@@' rely on an interesting property of the evaluator: > you type `(@ (guile) car)', `@' returns a *variable*, but what you get > is a *procedure*, because in the meantime, the evaluator automagically > performed a `variable-ref'. This is not very elegant in my opinion. However, I think it means that if the variable is then changed, the code that included the (@ ...) expression will get the new value next time it is executed. This means that `(@ module identifier)' acts like a plain old `identifier', in the sense that it gives you a location - whose value may change over time - rather than the fixed value of the identifier at the time the code was first executed. I think that's a feature, and it's probable that someone somewhere is relying on it. > With that in mind, I propose instead the following patch, which also > fixes your problem AFAICS: > > --- /home/ludo/src/guile/1.8/guile-core/ice-9/boot-9.scm.~1.356.2.10.~ 20= 07-09-01 19:11:00.000000000 +0200 > +++ /home/ludo/src/guile/1.8/guile-core/ice-9/boot-9.scm 2008-03-05 17:25= :15.000000000 +0100 > @@ -2988,7 +2988,7 @@ > (let ((var (module-variable (resolve-interface mod-name) var-name))) > (if (not var) > (error "no such public variable" (list '@ mod-name var-name))) > - var)) > + (variable-ref var))) >=20=20 > ;; The '@@' macro is like '@' but it can also access bindings that > ;; have not been explicitely exported. > @@ -2997,7 +2997,7 @@ > (let ((var (module-variable (resolve-module mod-name) var-name))) > (if (not var) > (error "no such variable" (list '@@ mod-name var-name))) > - var)) > + (variable-ref var))) If I've understood it correctly, I think this patch would change existing behaviour, by returning a fixed value rather than a location. Could we not look at fixing (ice-9 syncase) instead, so that it understands variables? Regards, Neil