@ -34,6 +34,11 @@
#:description " id in syntaxed form "
( pattern ( syntax name:id ) ) )
( define-syntax-class syntaxed-thing
#:literals ( syntax )
#:description " some datum in syntaxed form "
( pattern ( syntax thing:expr ) ) )
( syntax-parse stx
#:literals ( syntax )
[ ( _ ( syntax ( id pat-arg ... . rest-arg ) ) body ... ) ; (define #'(foo arg) #'(+ arg arg))
@ -48,6 +53,9 @@
[ ( _ sid:syntaxed-id sid2:syntaxed-id ) ; (define #'f1 #'f2)
#' ( define-syntax sid.name ( make-rename-transformer sid2 ) ) ]
[ ( _ sid:syntaxed-id sid2:syntaxed-thing ) ; (define #'f1 #'42)
#' ( define-syntax sid.name ( λ ( stx ) sid2 ) ) ]
[ ( _ ( sid:syntaxed-id stx-arg ... ) expr ... ) ; (define (#'f1 stx) expr ...)
( raise-syntax-error ' define " definition of a syntax transformer must use lambda notation, because otherwise it's too easy to confuse the compile-time shape and the run-time shape " ( syntax->datum #' sid.name ) ) ]