[plt-scheme] syntax-parse literals
The set of literals that can be used in syntax-parse have to be defined
which quickly leads me to a situation where I have duplicate
identifiers. Is there some way to tell syntax-parse an identifier is a
literal without defining it? In general it seems like a bad idea to have
to define all literals as it pollutes the namespace.
This code gives a duplicate identifier for 'a' and 'b'.
(define (test2)
(define-syntax mymacro
(syntax-rules ()
[(_ (literal ...)
(name pattern ...)
template)
(begin
(define-syntax literal (lambda (stx) (error 'literal "dont use
this"))) ...
(define-syntax (name stx)
(syntax-parse stx
#:literals (literal ...)
[(_ pattern ...) #'template])))]))
(mymacro (a b) (foo a b) 1)
(mymacro (a b) (bar a b) 2)
(foo a b))