Signaling errors in macro transformers
(syntax-error
{message} {args} ...
)
syntax
syntax-error behaves similarly to error (6.11) except that implementations
with an expansion pass separate from evaluation should signal an error
as soon as syntax-error is expanded. This can be used as
a syntax-rules template for a pattern that is
an invalid use of the macro, which can provide more descriptive error
messages. message is a string literal, and args
arbitrary expressions providing additional information.
Applications cannot count on being able to catch syntax errors with
exception handlers or guards.
(define-syntax simple-let
(syntax-rules ()
((_ (head ... ((x . y) val) . tail)
body1 body2 ...)
(syntax-error
"expected an identifier but got"
(x . y)))
((_ ((name val) ...) body1 body2 ...)
((lambda (name ...) body1 body2 ...)
val ...))))
|