What's wrong with D's templates?

Don nospam at nospam.com
Tue Dec 22 02:06:13 PST 2009


Walter Bright wrote:
> Yigal Chripun wrote:
>> But that doesn't mean the idea itself isn't valid. Perhaps a different 
>> language with different goals in mind can provide a much simpler non 
>> convoluted implementation and semantics for the same idea?
>> You've shown in the past that you're willing to break backward 
>> compatibility in the name of progress and experiment with new ideas. 
>> You can make decisions that the C++ committee will never approve.
>>
>> Doesn't that mean that this is at least worth a shot?
> 
> I believe that D's template constraint feature fills the bill, it does 
> everything Concepts purported to do, and more, in a simple and easily 
> explained manner, except check the template body against the constraint.
> 
> The latter is, in my not-so-humble opinion, a desirable feature but its 
> desirability is overwhelmed by the payment in complexity and 
> constrictions on the Concepts necessary to make it work.

I think a consequence of that, is that facilities for compile-time 
testing become quite important, since we're relying on testing rather 
than compile-time checks to eliminate bugs.
So I'm delighted that the static assert backtrace patch has been 
implemented.
(One very useful feature would be code-coverage of template 
instantiations -- which lines of a template have actually been 
instantiated?)



More information about the Digitalmars-d mailing list