Re: What is "Metaprogramming" paradigm is used for?
I explained some basic metaprogramming stuff in my [article on NimYAML](https://flyx.org/2016/09/22/nimyaml/). Actually, [NimYAML](http://forum.nim-lang.org///nimyaml.org) as a whole is a good example of metaprogramming usage, because what is does is not doable in most other languages (though some „cheat“ by using reflection, which is inferior). [emerald](http://forum.nim-lang.org///flyx.github.io/emerald/) is another project of mine which makes extensive use of metaprogramming. Actually, I initially wrote that to test Nim's metaprogramming capabilities. For snippets, a template usually suffices, you do not need macros for that. It is important to recognize when you do _not_ need macros. The actual use-cases for macros are rather rare, because you should always use the least powerful tool that can do the job, and that mostly boils down to generics and/or templates even for complex problems.
Re: What is "Metaprogramming" paradigm is used for?
I mean, that macros open up new ways to piss off coworkers. For example when you constantly rely on the fact that some structures get rewritten by some macro, and every developer in the team has his own set of macros that he uses in the project, you could end up in a situation where nobody is able to read the code of another developer. In this state the problem could propel itself, because when you don't understand other peoples code it is unlikely that you would reuse that code, and very similar things could be implemented several times, just because team member become unable to reuse each others code. I am not talking from experience here, I did not yet program in a team with Nim or Lisp, but I can imagine that it can happen, when people work carelessly.
Re: What is "Metaprogramming" paradigm is used for?
Krux02, what do you mean by "with power comes responsibility"? You mean bugs, crashes, maintainable, difficult or what?
Re: What is "Metaprogramming" paradigm is used for?
Generally metaprogramming is uned to do what it is called, use the program itself as data that can be transformed. There is a lot you can do with it, some of the use cases I can name, but others are only limited by your imagination and the limits of the metaprogramming facilities of the language. * You can create a macro that adds debug information to a program in the way you need it at that moment. * You can write macros that to add create new language features/ expressability. [https://github.com/andreaferretti/patty](https://github.com/andreaferretti/patty) * If you are in an environment, where you need to write a lot of glue code, you could use macros to generate the glue code. [https://github.com/krux02/opengl-sandbox](https://github.com/krux02/opengl-sandbox) * Almost any code snippet you use often can instead be macro (not really metaprogramming, since it doesn't have any behavior depending on the argument) * Anything that requires you to have a code generator in other languages, you can instead solve with metaprogramming. So if projects like YACC would be translated to nim its code generation part could be replaced by macros. * You could write code analysis tools, without the aid of an external language parser. * embedded domain specific languages Basically it extends the amount of problems you can solve within the language. But be careful, with power comes responsibility, and I am pretty sure in an environment wher macros are just available to any developer, you have a lot of opportunities to write unmaintainable code.
What is "Metaprogramming" paradigm is used for?
In many languages, macros and meta-programming paradigm does not exist, most of the time, especially in industries, they focus on object-oriented and functional paradigms.