guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: rackets syntax parse


From: Stefan Israelsson Tampe
Subject: Re: rackets syntax parse
Date: Tue, 7 Feb 2012 22:58:18 +0100



On Tue, Feb 7, 2012 at 10:37 PM, Andy Wingo <address@hidden> wrote:
On Sat 04 Feb 2012 21:31, Stefan Israelsson Tampe <address@hidden> 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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]