[gambit-list] Hygienic macros failing?

andrew cooke andrew at acooke.org
Sat Aug 18 23:29:19 EDT 2007


I may be misunderstanding hygienic macros here, but as far as I can tell I
am getting variable capture.

(define-syntax bad
  (syntax-rules ()
    ((_ (arg1 ...) (arg2 ...))
     (receive (a b c) (values arg1 ...)
       (newline)
       (write (list arg2 ...))))))

(receive (a b c) (values 1 2 3) (bad (7 8 9) (a b c)))

This displays (7 8 9) when arg2 should be (1 2 3) (the value of a b c in
the calling code, not the value in "bad").

It can be avoided by using different variable names, but that should not
be necessary, right?

Thanks,
Andrew

PS Gambit Version 4.0 beta 22, on Suse linux 10.2, amd64.





More information about the Gambit-list mailing list