[plt-scheme] macro-generating macros and the bizarre properties of syntax-local-get-shadower

From: Dimitris Vyzovitis (vyzo at media.mit.edu)
Date: Mon May 14 22:06:27 EDT 2007

On Tue, 15 May 2007, Matthew Flatt wrote:

> At Mon, 14 May 2007 21:38:39 -0400 (EDT), Dimitris Vyzovitis wrote:
> > On Tue, 15 May 2007, Matthew Flatt wrote:
> >
> > > I looks like Ryan and I replied at about the same time. Read Ryan's
> > > first, and then read mine as an elaboration of this paragraph in Ryan's
> > > message:
> > >
> > > At Mon, 14 May 2007 18:19:58 -0400, Ryan Culpepper wrote:
> > > > When this macro is called, it looks up the value associated with 'foo1':
> > > > that's the number 1. Then it tries to turn it into an expression with
> > > > that quasisyntax business. But doing it that way doesn't give it a
> > > > '#%datum' binding, and that leads to the syntax error.
> >
> > I understand the problem. I see it is an instance of the more general
> > problem of meta-level transformer environments.
>
> No, not at all. The `generate-temporaries' procedures returns
> identifiers that have no initial context in any phase. That's not
> because it has trouble importing bindings into various phases, but
> because it cannot guess the context where you're going to use the
> temporary identifiers.

Well, the same issue appears without gentemps in quite a few cases.
The example was rather contrived as it was extracted from a much
bigger and complicated piece of code.
[among others it involves  macro-generated define-match-expanders which
are particularly nasty pieces and don't even need quasisyntax to bork]

Most of the times it can be side-stepped with careful placement of
context-providing operations, but it becomes difficult in complicated
code; I really shouldn't have to do this just to get standard
functionality in the meta-transformer environment.

-- vyzo



Posted on the users mailing list.