How to warn new users away from metaprogramming

A very nice introduction to (Common Lisp) macros can be found in Peter Seibel’s Practical Common Lisp:

http://gigamonkeys.com/book/macros-defining-your-own.html

complete with a just-so-story, discussion of leaks, and how to plug them.

I have been a very heavy user of Common Lisp macros, to the extent that I wrote a macro-heavy library which still ends up in the top 10 Quicklisp downloads.

But I avoid them almost completely in Julia, except for replacing repetitive code in loops with @eval. I think this is because

  1. as emphasized above, the language itself is much more powerful so syntactic transformations are needed much less.

  2. macros do not blend seamlessly into syntax like S-expressions (I am not talking about the @).

  3. Julia has taken a different route to macro hygiene which I find difficult to work with conceptually for complex macros, especially macro-writing macros.

7 Likes