`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?
_________________________________________________
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users

Reply via email to