How to warn new users away from metaprogramming

The biggest problems I see with mis-use of metaprogramming are

  • people who fundamentally don’t understand what macros are and when they run, and are trying to use them for runtime calculations or think they can do something other than saving typing. Consequence: frustration and confusion.

  • people who want to pass function arguments as strings or expressions rather than as…functions. Consequence: frustration and confusion about scope, and terrible performance if they get it to work.

  • trying to use lots of generated variables rather than using a container data structure (e.g. a Dict). Consequence: frustration and confusion about scope, and (probably) inflexible and unreadable code.

24 Likes