I just pushed a long outstanding fix to match-letrec
for when you actually use recursive references.
This required the unhygienic insertion technique first
described by Al* Petrofsky in the c.l.s post "How to
write seemingly unhygienic macros using syntax-rules"
from Nov 2001, and detailed by Oleg at the 3rd
Workshop on Scheme & FP[1]. This should be added
to the references.
This technique is, in general, not fool-proof and cannot be.
It does a textual scan of a body, which is almost never the right thing.
When the body contains a macro use, only whose expansion will produce the identifier sought after, the technique will break.
I haven't checked your code so I don't know whether it is effected.
But the paper promises too much. And in some sense, it is trivial: By reimplementing the Scheme syntax expander in term of hygienic macros, which are Turing-complete, you can make the expansion work as you wish.
The pure syntax-rules implementation now runs the
full gamut of classic syntax-rules tricks.
--
Alex