justinethier/husk-scheme — Issue #54: Quoting inside a macro may expose intermediate symbols
Author: justinethier
Created: 2011-11-09 18:00:56+00:00
State: open

Consider the following macro:
(define-syntax my-do/2
(syntax-rules ()
((_ ((var init . step) ...)
(test expr ...)
command ...)
(let loop ((var init) ...)
(if test
(begin expr ...)
(begin (begin command ...)
(quote (loop
(list var . step) ...))))))))

And an application of the macro:

(write
(my-do/2 ((vec (make-vector 5) vec)
(i 0 (+ i 1)))
((= i 5) vec)
(vector-set! vec i i)))

The result of this call should be `(loop (list vec vec) (list i (+ i 1)))` but instead many of the symbols in the result are "mangled" by macro hygiene: `(loop228 (list vec29 vec29) (list i30 (+ i30 1)))`