[racket] Abstracting over redex language via macro causes scope issues

From: J. Ian Johnson (ianj at ccs.neu.edu)
Date: Tue Nov 29 19:45:22 EST 2011

Nevermind. Hygiene.
-Ian
----- Original Message -----
From: "J. Ian Johnson" <ianj at ccs.neu.edu>
To: "users" <users at racket-lang.org>
Sent: Tuesday, November 29, 2011 7:44:21 PM GMT -05:00 US/Canada Eastern
Subject: [racket] Abstracting over redex language via macro causes scope issues

Consider the following racket program:

#lang racket
(require redex/reduction-semantics)
(define-language L
  [bar natural]
  [H (side-condition (name f any) (foo (term f)))])
(define-syntax-rule (foo i) (redex-match L bar i))

This expands just fine. However, try to abstract over L via a macro:

#lang racket
(require redex/reduction-semantics)
(define-syntax-rule (M lang)
  (define-syntax-rule (foo i) (redex-match lang bar i)))
(define-language L
  [bar natural]
  [H (side-condition (name f any) (foo (term f)))])
(M L)

I get the error that foo is undefined. Why?

-Ian
_________________________________________________
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Posted on the users mailing list.