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.

Reply via email to