No subject


Sat May 2 20:29:37 PDT 2009


>But there is a rule in C++ and D that a template with a specific set of arguments can only have one instantiation for the whole program. This means that if the template has already been instantiated with the same arguments, we can simply point to that instantiation and we're done.<

Templates are as functions with the "pure" attribute, so the same input gives the same output.

Most of the things you can do with templates can be done with functions (even not pure ones!) run at compile-time that are also allowed to use (and receive/return) a type of compile-time variables of type "type" :-) I think this may lead to a language that's cleaner than C++/D-style templates.

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list