3 ms·
While I mostly agree with what you are saying I think that there is a place for metaprogramming and some programming languages implement metaprogramming very we
by dom96 13y ago
While I mostly agree with what you are saying I think that there is a place for metaprogramming and some programming languages implement metaprogramming very well.
Using metaprogramming should not make you "feel bad", however it should not be used excessively. Metaprogramming gives you a lot of power, it allows you to extend the language in any way you please. With this great power, of course, comes great responsibility but I would rather have the option to use this power than to not have it at all.
I would also argue that metaprogramming can enable your code to be more efficient, if the macros/templates you write are evaluated at compile-time. This is the approach that the Nimrod programming language (http://nimrod-code.org http://nimrod-code.org) takes and it works well. This also means that in most cases compilation will fail if the macro is incorrect instead of causing some silent errors at runtime.