[racket] define-syntax vs let-syntax
`define-syntax' has different behavior from `let-syntax' when the
transformer operates on top-level bindings in the transformer environment.
(define-for-syntax foo 1)
(define-syntax (x1 stx)
(printf "z: foo is ~a\n" foo)
(set! foo (add1 foo))
(printf "z: foo is ~a\n" foo)
#'1)
(x1)
#;
(let-syntax ([x1 (lambda (stx)
(printf "z: foo is ~a\n" foo)
(set! foo (add1 foo))
(printf "z: foo is ~a\n" foo)
#'1)])
(x1))
With `define-syntax' I see
z: foo is 1
z: foo is 2
But with `let-syntax' I see
z: foo is 1
z: foo is 1
Is this a bug or am I missing something?