Do not confuse the word **template** in D with the same word in Nim, they are 
not the same thing at all. Perhaps that's why there's such misunderstanding, 
and why the proposed solution didn't even come close to doing what the D 
template I wrote does?

I referred to ML modules in my description above, and that behavior of not 
creating a new code block with the same type param is similar to applicative 
functors (OCaml) vs generative functors (SML). For OCaml experts, yes I know 
that OCaml has supported both for a while.

In any case, D uses this stuff to good effect, and there seems to be no 
straightforward way to model the salient aspects of D templates as code blocks 
in Nim. What they are providing is a **generic** (in the Nim sense) scope which 
can be referred to elsewhere. In D I can alias an instantiation to a shorter 
name, but I didn't demonstrate that. What I did show is that you can 
instantiate multiple ones in the same scope, refer to them, and refer to their 
internal variables.

Reply via email to