[plt-scheme] syntax-case and the name 'debug'
At Wed, 22 Oct 2003 14:35:09 -0400 (EDT), Guillaume Marceau wrote:
> > (syntax-case (quote-syntax asd) ()
> [(#%top . id) (debug "asd")]
> [_ (debug 5)])
> STDIN::77: #%top: illegal use of syntax in: (#%top . debug)
This is certainly deeply confusing...
To simplify a little, and to show that "debug" is not special:
> (syntax-case not-even-evaluated ()
[(#%top . any) xdebug])
repl-1:2:21: #%top: illegal use of syntax in: (#%top . xdebug)
The problem is that xdebug is implictly wrapped with "#%top", like any
reference to a top-level variable. But the implicit "#%top" gets
captured by the syntax binding in the pattern!
I think it's likely that you meant to list `#%top' as a literal.
Otherwise, you can just pick a different name for the pattern. (Either
will avoid the problem.)
Matthew