Understanding Templates: why can't anybody do it?

Xinok xinok at live.com
Sat Mar 17 11:47:48 PDT 2012


On Saturday, 17 March 2012 at 18:16:31 UTC, Walter Bright wrote:
> i.e. templates are type parameters.

Maybe in C++. In C++, templates are attached to a class or 
function, where as in D, they're an independent construct. The 
way I think of it, templates are a tool for building static code 
from a set of parameters. String mixins are a similar tool which 
are more powerful but less elegant.

Programmers will use templates for unintended purposes, but that 
doesn't change what they are. You can use full closures to store 
references to variables, but that doesn't make functions 
reference types.


More information about the Digitalmars-d mailing list