[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: hygiene when using multiple instances of a macro..?



I'll try to write a macro definition to show the situation I was talking
about:

(define-syntax (can-we-stand-duplicates a-macro)
  (quasisyntax
    (if ,a-macro
      (let ((x 3)) (,a-macro #f))
      x)))

(define-syntax (test)
  (quasisyntax (can-we-stand-duplicates can-we-stand-duplicates)))

(test)

... if it works wrong, it expands to (something that evaluates to) 3.
If it works right, it expands to something that has an unbound
identifier.

The reason I suspected the wrong behavior is that in some rewrite-based
systems, the fact the both x's are created in the same context (here, in
the same quasisyntax) suffices to make them identical, even though they
should not be identical across different invocations of the macro.

Panu

-- 
personal contact: atehwa@xxxxxx, +35841 5323835, +3589 85619369
work contact: panu.kalliokoski@xxxxxxxxxxx, +35850 3678003
kotisivu (henkkoht):	http://www.iki.fi/atehwa/
homepage (technical):	http://sange.fi/~atehwa/