On 6/15/2014 6:12 PM, H. S. Teoh via Digitalmars-d wrote:
I think you may have missed the fact that your very realization was a
further development in itself. The term "template" comes from the C++
idea of having a pre-written piece of code with some blanks in a few
places, that will be filled in to make the actual code. But the concept
of "compile-time parameter" is something conceptually different, and
more powerfully unifying IMO. It digs at the root of C++'s template
nastiness, which ultimately comes from treating template parameters as
something fundamentally distinct from function parameters. The ugly
syntax is but the superficial expression of this underlying difference
in conception. D's superior template syntax is not merely a better
dressed syntax; it ultimately stems from treating template parameters as
being the *same* thing as function parameters -- except they are
evaluated at compile-time rather than runtime.

This insight therefore causes D's templates to mesh very nicely with
CTFE to form a beautifully-integrated whole.

I like the way you think. Can I subscribe to your newsletter? :-)


I like how TDPL introduces templates by not introducing them at all, but
just talks about compile-time arguments. By the time the reader gets to
the chapter on templates, he's already been using them comfortably.

Our eevil plan at work!


But on that note, perhaps it's not altogether a bad thing for the word
"template" to have a negative connotation; perhaps we should be pushing
the term "compile-time parameter" instead. It engenders an IMO superior
way of thinking about these things that may help newcomers overcome the
fear of metaprogramming.

!

Reply via email to