Thursday, February 28, 2008

Hygienic Macros, Embedded Languages, and Lisps

So I've been writing (common) lisp code the last couple weeks in my spare time (or some of my spare time), and was thinking about the language, and realized why I never really liked Scheme's hygienic macros. The macro system is basically it's own little embedded (turing complete, as it turns out) language. So when you decide "hey, I need a macro" you need to mentally switch to a new language. You've been writing various list-manipulation code with first, rest, do, whatever tools you like, and all of a sudden... you're using a new, different language to .... manipulate lists. And it's not a trivial/easy language. Loop is a special little language embedded in Lisp, but pretty straightforward. Who really can't guess what (loop for i from 1 to 10 summing i) does? (Actually, it's a fairly cobol-like language, on reflection, funny given how much I like loop, and mock cobol ;)

No comments: