4 ms·
metaprogramming is not a virtue programming languages do not themselves need to be programmable
by preseinger 3y ago
metaprogramming is not a virtue
programming languages do not themselves need to be programmable
- pjmlp 3y agoThat is why stuff like m4 gets born.
- rcxdude 3y agoMy experience suggests otherwise. If the appropriate facilities don't exist in a language, users will resort to code generation.
- preseinger 3y agousually, code generation is preferable to metaprogramming, mostly because it is easier to understand and maintain
- kazinator 3y agoCode generation is just external macros; it's the same thing in a worse form. To maintain the code, you have to understand the input language to the code generator and its metaprogramming constructs. You're no better off in that regard. The grandparent comment is saying that if you don't give people metaprogramming built-in, they will resort to outboard metaprogramming. I.e. you can't stop people from metaprogramming.
- preseinger 3y agocode generators are programs written in an existing programming language, which produce target language source code as output macros are programs written in a separate, unique, often turing-complete meta-language, which is implemented entirely in the compile phase of the language which supports them they're in no way equivalent