Walter Bright:
> http://www.reddit.com/r/programming/comments/8wgak/compiling_templates/

It looks like a quite complex machinery.

>From the article:
>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

Reply via email to