[plt-scheme] Identifier macro assignment: syntax-id-rules vs. syntax-case
I tried naively to translate the language manual's `pwd' macro
(section 12.1) from the syntax-id-rules form to syntax-case:
(define-syntax (pwd stx)
(syntax-case stx (set!)
[(set! pwd expr) #'(current-directory expr)]
[(pwd expr ...) #'((current-directory) expr ...)]
[pwd #'(current-directory)]))
Rather than expanding according to the first case, the expression
(set! pwd "/tmp") tries to mutate the `pwd' binding. Why doesn't this
happen when the macro's defined with syntax-id-rules?
Thanks,
Casey