Woohoo! My macros are now (semi) hygienic



Based on recent discussions with Pascal and Kent, I just got (semi)
hygienic macros to work in my lexicon system. (I figure since Kenny
plugs cells here all the time it's OK for me to do the same for
lexicons.) I can now do this:

? (ldefun myfn (x) (list 'myfn x))
MYFN
? (ldefmacro mymacro (x) `(list (myfn ',x) (,myfn ',x)))
MYMACRO
? (flet ((myfn (x) (list 'local-myfn x))) (mymacro foo))
((LOCAL-MYFN FOO) (MYFN FOO))
?

Cool, huh?

I call them semi-hygienic because they only properly capture global
lexical bindings, not local ones, and you still have to insert gensyms
manually where needed. But this was the last thing I needed to make
lexicons really ready for prime time. It is now possible to write safe
modular macros in Common Lisp without packages. No more symbol name
conflicts!

I was just so excited I had to tell someone. :-)

rg
.