Hi guile,
Consider this program:
(define-syntax unhygienic
(syntax-rules ()
((_ the-pair fetch)
(begin
(define the-head (car the-pair))
(define (fetch) the-head)))))
(unhygienic '(1) fetch1)
(unhygienic '(2) fetch2)
(fetch1)
;; => 2
It seems that the second call to unhygienic shadows the previous
definition of the-head. I expected syntax-rules to generate fresh names
for it each time.
Is this expected, and if so, is there any way to generate an internal
definition using syntax-rules? For my case, I was writing a macro to
generate SRFI-9 record definitions, but I noticed some of the getters
and setters which I intended to be private were shadowing each other.
Best,
Walter