Metaprogramming is a great feature of Julia, allowing advanced users to introduce syntactic extensions with macros, and work around code optimization problems using generated functions. However, it is somewhat of an advanced technique with particular pitfalls, and in practice it is needed much less frequently than some new users of Julia realize, possibly because the basic building blocks of Julia are so powerful.
From some discussions on this forum, it appears metaprogramming is considered as the first solution technique for some users in situations when closures, parametric types, multiple dispatch, traits, and near-zero cost abstraction would be much more idiomatic and compiler friendly.
A particularly problematic senario is when users try to construct code from strings, then parse and evaluate it.
I think that we could do more to clarify these things, but it is not clear to me how to do this best, so I would like to solicit suggestions.
I would consider the following:
a warning at the beginning of the metaprogramming chapter in the manual
possibly suggestions of alternative techniques, eg higher order functions. Should the manual include a quick tutorial about higher order functions (easier to maintain it there)?
should the manual warn about using code generation for simple problems as code smell?
would a FAQ entry about constructing ASTs from strings (“just don’t do it”) make sense?