[racket-dev] [plt-scheme] Bug or misuse? match-expander ids not properly working (patch)

From: Eli Barzilay (eli at barzilay.org)
Date: Fri May 4 20:13:09 EDT 2012

A few minutes ago, Carl Eastlund wrote:
> On Fri, May 4, 2012 at 4:37 PM, Eli Barzilay <eli at barzilay.org> wrote:
>     In case it wasn't clear enough, I said that I don't mind having
>     it (and I'm willing to add it) -- I only added that I don't see
>     any *practical* case where you'd use it.
> Okay, then I think we're more or less on the same page.

Yes -- finally!  I wanted to suggest that you try to find a counter
example -- I knew about the below, and about the problems with `_' and
`...', and with other non-identifier patterns.

> I do think there is a practical use for such a form; specifically,
> macros that expand into a use of match. [...] There's no real reason
> clients of let/list should know that match is even involved.

Right!  Now I can say that when I said "*practical*" above, I meant
cases where this is actually used in practice, and that I don't know
about such cases and finally (this was extremely implicit though),
that you already don't want these cases because of the existing
problems...  (And there are other problems: you could have a number or
some other non-identifier, which you just happen to bypass using
`syntax-parse', and there are also repeated identifiers.)

> There are existing solutions -- don't use match in macros, or always
> bind an extra set of temporaries -- but adding some kind of "no
> really, bind this please" form would be even simpler.

Now, given that this is already a problem, the such a solution is
desirable in any case.  Two notes: (1) the documentation would say
that this is mostly for macros that expand to a `match' (or a
derivative); (2) you can now see why I said "*very* few" -- since
there are no such macros (ie, in almost all cases, when you build
something with `match', it's because you *want* to inherit its pattern

Still, the remote possibility of such macros is why I said that I'm
fine with such an addition.

          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                    http://barzilay.org/                   Maze is Life!

Posted on the dev mailing list.