Templates everywhere
Walter Bright
newshound1 at digitalmars.com
Sun Mar 14 15:33:13 PDT 2010
Philippe Sigaud wrote:
> Years ago, although I had implemented templates for C++, I didn't
> "get" them. Not at all. I didn't even plan to put templates in D,
> because they seemed overly complex, ugly, and had little value.
>
> That's interesting to know that you could implement templates, without
> understanding them.
I think of it like a race car builder. I can build the cars, but I can't
drive them worth squat. We are very fortunate, however, to have Andrei
on board who literally wrote the book on how to drive them!
> The third 'leg' on which D templates rest is the alias parameters. I can
> have access to any symbol, including other templates? Oh yes!
In C++, these are called "template template parameters". It took me a
long time to figure out what the point to template template parameters
was, and then I wondered at the arbitrary restriction that they must be
templates. Remove the restriction, and voila! Much more power! (And a
much simpler explanation of them, too.)
More information about the Digitalmars-d
mailing list