If you use a template as an inline function you need to be extra careful to 
avoid double evaluation of parameters. Also there are some situations like with 
var return parameters where in Nim it's impossible to replicate the exact 
behaviour of a (inlined) proc with a template until views are stabilised unless 
you use some serious pointer based workarounds.

> In a way this shows how nim can let you do thinks that are not possible (or 
> very difficult or clunky) in C, despite the fact that it compiles down to C.

In C you can use a macro for that or on gcc `__attribute__((always_inline))`. 
But with the first you get the same issue of parameter double evaluation.

In the end in both templates in Nim and macros in C both are pretty poor inline 
functions and better suited for things like reducing code duplication in some 
situations, etc.

Reply via email to