Simplifying templates

Michel Fortin michel.fortin at michelf.com
Mon Dec 1 04:33:34 PST 2008


On 2008-11-30 11:00:07 -0500, dfgh <dfgh at mailinator.com> said:

> That is very similar to my idea, except it would allow dynamic typing. 
> We do have dynamic typing to some extent in D (Variant's, variadic 
> functions), but it slows down code. I prefer enforcing static typing, 
> especially given D's design goals, such as systems programming. Code 
> that needs dynamic typing is the exception, so it gets Variant's rather 
> than a part of the core language.

Yes and no. My idea was that such functions would only work at compile 
time (like current CTFE). When mixed with other parameters the part 
about the types would need to work at compile time, it would create a 
new function instance for each type argument you give it in the 
arguments. Basically, it'd behave mostly as current function templates.

It has been proposed in that thread that this be extended to dynamic 
typing, which I agree could be done using the same syntax. But dynamic 
typing is out of my proposal.


-- 
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/




More information about the Digitalmars-d mailing list