On Sunday, 14 December 2014 at 00:45:06 UTC, Manu via
Digitalmars-d wrote:
On 13 December 2014 at 15:11, Walter Bright via Digitalmars-d
A function template is a function that takes both compile-time
args and
run-time args. C++ tried to make them completely different
animals, when
they are not. Don't think "template", think "compile-time
argument to a
function". I convinced Andrei to never mention "template" in
his D book, as
it brings forth all kinds of connotations and expectations
that impede understanding what D templates actually are. I
think the result was successful.
You can spin it however you like, but it's exactly the same
thing.
They are completely different animals. A function template is
not a
function at all until it's instantiated. When it's
instantiated, it
becomes a function, or even, one of a suite of functions. And
it's not known to the author where the function is.
(Note: I define 'function' in this context to mean 'some code
that is emitted')
Philippe Sigaud Excellent "D Templates: A Tutorial"...
the MANTRA...
"XXX templates are not XXXs, they are templates. With XXX being
any of (function, struct, class, interface, union)."
---
/Paolo