Woohoo! My macros are now (semi) hygienic
- From: Ron Garret <rNOSPAMon@xxxxxxxxxxx>
- Date: Fri, 22 Feb 2008 00:46:50 -0800
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
.
- Follow-Ups:
- Re: Woohoo! My macros are now (semi) hygienic
- From: Kaz Kylheku
- Re: Woohoo! My macros are now (semi) hygienic
- From: Leslie P. Polzer
- Re: Woohoo! My macros are now (semi) hygienic
- Prev by Date: Re: GCC & Lisp
- Next by Date: Re: notation
- Previous by thread: job question
- Next by thread: Re: Woohoo! My macros are now (semi) hygienic
- Index(es):