[plt-scheme] Macros that expand to macro definitions

From: Arjun Guha (garjun at cs.brown.edu)
Date: Tue Jul 26 16:11:48 EDT 2005

This (contrived) example doesn't work:

   (define-syntax (foo stx)
     (syntax-case stx ()
       [(_ foo-expr ...)

            (define-syntax (bar stx)
              (syntax-case stx ()
                [(_ (bar-expr ...))
                     (printf "~a~n" 'bar-expr) ...)]))

            (bar foo-expr) ...)]))

I get:

Welcome to DrScheme, version 299.106-svn16jun2005.
Language: (module ...).
syntax: no pattern variables before ellipses in template in: ...

However, if I remove the ellipses, so that the pattern for the inner bar 
macro is (_ (bar-expr)), it works just fine.  Is there any way to use ... 
in bar?



Posted on the users mailing list.