From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andreas Rottmann Newsgroups: gmane.lisp.guile.user Subject: Re: bindings for free identifiers in (ice-9 syncase) Date: Thu, 19 Mar 2009 17:32:04 +0100 Message-ID: <87mybhfp8b.fsf@delenn.lan> References: <2bc5f8210903190816y1ac88329td55765faeb081672@mail.gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1237484161 1200 80.91.229.12 (19 Mar 2009 17:36:01 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 19 Mar 2009 17:36:01 +0000 (UTC) Cc: Guile Users To: Julian Graham Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Thu Mar 19 18:37:18 2009 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1LkMAx-0007nR-BV for guile-user@m.gmane.org; Thu, 19 Mar 2009 18:37:03 +0100 Original-Received: from localhost ([127.0.0.1]:33141 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LkM9a-00063c-EF for guile-user@m.gmane.org; Thu, 19 Mar 2009 13:35:38 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LkLCU-0003ey-70 for guile-user@gnu.org; Thu, 19 Mar 2009 12:34:34 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LkLCP-0003Zm-D2 for guile-user@gnu.org; Thu, 19 Mar 2009 12:34:33 -0400 Original-Received: from [199.232.76.173] (port=42163 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LkLCP-0003Zb-0U for guile-user@gnu.org; Thu, 19 Mar 2009 12:34:29 -0400 Original-Received: from mail.gmx.net ([213.165.64.20]:43618) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1LkLCO-0002oj-FW for guile-user@gnu.org; Thu, 19 Mar 2009 12:34:28 -0400 Original-Received: (qmail invoked by alias); 19 Mar 2009 16:34:21 -0000 Original-Received: from 83-215-154-5.hage.dyn.salzburg-online.at (EHLO nathot.lan) [83.215.154.5] by mail.gmx.net (mp069) with SMTP; 19 Mar 2009 17:34:21 +0100 X-Authenticated: #3102804 X-Provags-ID: V01U2FsdGVkX18SnVJjEMESxaFpEL51snLCZdk4/FNLLkO6gEqcOO 0OnZbE3S6pxGqq Original-Received: by nathot.lan (Postfix, from userid 121) id 6AC903A68F; Thu, 19 Mar 2009 17:34:21 +0100 (CET) Original-Received: from delenn.lan (delenn.lan [192.168.1.11]) by nathot.lan (Postfix) with ESMTPS id EC9C73A685; Thu, 19 Mar 2009 17:34:19 +0100 (CET) Original-Received: from rotty by delenn.lan with local (Exim 4.69) (envelope-from ) id 1LkLA4-0000uZ-1i; Thu, 19 Mar 2009 17:32:04 +0100 In-Reply-To: <2bc5f8210903190816y1ac88329td55765faeb081672@mail.gmail.com> (Julian Graham's message of "Thu, 19 Mar 2009 11:16:12 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.91 (gnu/linux) X-Y-GMX-Trusted: 0 X-FuHaFi: 0.6 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:7174 Archived-At: Julian Graham writes: > Hi Guilers, > > Alright, I've been banging my head against this for several weeks now > and only just had the time to sit down and research this: If you use a > symbol in an `(ice-9 syncase)' macro definition that's bound in the > lexical closure in which that definition lives, then that binding > should be the one that gets used at transformation time. At least, > that's how I interpret the following bit of R5RS: > > "If a macro transformer inserts a free reference to an identifier, the > reference refers to the binding that was visible where the transformer > was specified, regardless of any local bindings that may surround the > use of the macro." > > ...but that's not what Guile seems to do. (I'm fiddling around in > 1.9.0 HEAD, because the VM is awesome and because there are some > already-committed syncase fixes that have been useful to me...) If > you create the following module: > > (define (foo-module) > #:use-module (ice-9 syncase) > #:export-syntax (foo-macro)) > > (define (foo-function) (display "Hello, world!")) > > (define-syntax foo-macro > (lambda (stx) > (syntax-case stx () > ((_) (syntax (foo-function)))))) > > ...and then import `(foo-module)' into the REPL or somewhere else, > evaluating `(foo-macro)' throws an error because `foo-function' can't > be found. What am I doing wrong? > Nothing, this is a deficiency in Guile: https://savannah.gnu.org/bugs/?20941. I wonder why it is marked as "invalid", though. Regards, Rotty