From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Israelsson Tampe Newsgroups: gmane.lisp.guile.devel Subject: Re: rackets syntax parse Date: Tue, 7 Feb 2012 22:58:18 +0100 Message-ID: References: <874nviae6m.fsf@pobox.com> <8739am2um8.fsf@pobox.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=0015174bed267795af04b866e072 X-Trace: dough.gmane.org 1328651914 14693 80.91.229.3 (7 Feb 2012 21:58:34 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 7 Feb 2012 21:58:34 +0000 (UTC) Cc: guile-devel To: Andy Wingo Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Tue Feb 07 22:58:33 2012 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Rut3Y-0003kL-CG for guile-devel@m.gmane.org; Tue, 07 Feb 2012 22:58:32 +0100 Original-Received: from localhost ([::1]:56017 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rut3X-0006qU-OP for guile-devel@m.gmane.org; Tue, 07 Feb 2012 16:58:31 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:42495) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rut3S-0006qK-CR for guile-devel@gnu.org; Tue, 07 Feb 2012 16:58:30 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rut3O-0007NU-Gz for guile-devel@gnu.org; Tue, 07 Feb 2012 16:58:26 -0500 Original-Received: from mail-ee0-f41.google.com ([74.125.83.41]:39299) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rut3O-0007NQ-50 for guile-devel@gnu.org; Tue, 07 Feb 2012 16:58:22 -0500 Original-Received: by eekc13 with SMTP id c13so2701398eek.0 for ; Tue, 07 Feb 2012 13:58:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=Wjip2EGvok9s3u18m7z30TngvhHqg+3gBgzt50SQVP4=; b=mKB7DMrsbxtupMXkuLE4CivT/TlzzVmOB8K3s5YwMe0utmRO66Jm4sKFlhq93VtSSg k58FaZLDNwYcgffvJ310M5/FT8ifjkAm67Y0wQf4yj+SsF1FJVjGh3ryqUG71gBpQ0/e gxdFRxKap5sMAdfBSTGFT5/GwOLzLtEcA3vB8= Original-Received: by 10.213.16.199 with SMTP id p7mr3834343eba.141.1328651898950; Tue, 07 Feb 2012 13:58:18 -0800 (PST) Original-Received: by 10.213.105.141 with HTTP; Tue, 7 Feb 2012 13:58:18 -0800 (PST) In-Reply-To: <8739am2um8.fsf@pobox.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 74.125.83.41 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:13815 Archived-At: --0015174bed267795af04b866e072 Content-Type: text/plain; charset=ISO-8859-1 On Tue, Feb 7, 2012 at 10:37 PM, Andy Wingo wrote: > On Sat 04 Feb 2012 21:31, Stefan Israelsson Tampe > writes: > > > #'(begin > > (define f fkn-definition) > > (define-syntax name > > (make-syntax-case-transformer > > (make-stxclass > > ... > > (datum->syntax #'name 'f) > > ...)))) > > > > This code expans ok in the toplevel. But if expanded elsewhere in > definition > > context f is not reached from the data associated with the macro. > > So, a few things. > > One is that if #'name came from the macro invocation but f did not, then > indeed f is not visible from #'name. > > That this works at the top level is a byproduct of a bug in stable-2.0 > that is "fixed" in master. (There are two bugs: one about module > scoping of introduced toplevel identifiers, and another about the > symbolic names of introduced toplevel identifiers. See > https://savannah.gnu.org/bugs/?31472.) > > > So how can I make this to work in both contexts? > > Just use #'f instead of (datum->syntax #'name 'f). > I would love to use this, but when I tried that, the code failed in some cases, maybe because of the bugs you mensioned? I will probable fix this when you merge the fix mensioned above into stable meanwhile one can use with-syntax-class etc like constructs if in local scope. /Stefan --0015174bed267795af04b866e072 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable

On Tue, Feb 7, 2012 at 10:37 PM, Andy Wi= ngo <wingo@pobox.co= m> wrote:
On Sat 04 Feb 2012 21:31, Stefan Israelsson Tampe <stefan.itampe@gmail.com> wri= tes:

> #'(begin
> =A0=A0=A0=A0 (define f fkn-definition)
> =A0=A0=A0=A0 (define-syntax name
> =A0=A0=A0=A0=A0=A0=A0=A0 (make-syntax-case-transformer
> =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 (make-stxclass
> =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 ...
> =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 (datum-&g= t;syntax #'name 'f)
> =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 ...)))) >
> This code expans ok in the toplevel. But if expanded elsewhere in defi= nition
> context f is not reached from the data associated with the macro.

So, a few things.

One is that if #'name came from the macro invocation but f did not, the= n
indeed f is not visible from #'name.

That this works at the top level is a byproduct of a bug in stable-2.0
that is "fixed" in master. =A0(There are two bugs: one about modu= le
scoping of introduced toplevel identifiers, and another about the
symbolic names of introduced toplevel identifiers. =A0See
https://= savannah.gnu.org/bugs/?31472.)

> So how can I make this to work in both contexts?

Just use #'f instead of (datum->syntax #'name 'f).
=

I would love to use this, but when I tried that, the = code failed in some cases, maybe because of the bugs you mensioned? I will = probable fix this when you merge the fix mensioned above into stable
meanwhile one can use with-syntax-class etc like constructs if = in local scope.
/Stefan
--0015174bed267795af04b866e072--