[racket] define-syntax-class

From: Carl Eastlund (cce at ccs.neu.edu)
Date: Wed Apr 27 23:25:09 EDT 2011

On Wed, Apr 27, 2011 at 11:15 PM, Nadeem Abdul Hamid <nadeem at acm.org> wrote:
> On Wed, Apr 27, 2011 at 10:47 PM, Sam Tobin-Hochstadt <samth at ccs.neu.edu> wrote:
>>> If I move the syntax class
>>> definition into the bodies of define-syntax, then it works, but that
>>> defeats the purpose of being able to define a reusable syntax class...
>> You'll need to move the syntax class definition into a separate
>> module, and then `require' that module `for-syntax'.
> Other than the long name, would it make sense for there to be a
> 'define-syntax-class-for-syntax' form to avoid having to do this?
> --- nadeem

Modules currently can't define syntax for syntax.  However, you can
use define-syntax-set from mzlib/etc to define multiple macros at once
that share local bindings, such as syntax classes.  Since they're
lexical bindings rather than module bindings, they work just fine.  If
you want to export them and share them between files, however, you'll
need to use Sam's suggestion.


Posted on the users mailing list.