Proposal: static template(fail)

Jason House jason.james.house at gmail.com
Thu Dec 13 12:59:27 PST 2007


Janice Caron Wrote:
> You're missing the point, which is IT'S NOT AN ERROR. It's a
> substitution failure - and substitution failure IS NOT AN ERROR.
> That's a basic principle of template programming.

That's certainly true in C++, but I was not aware that was the way D template programming was intended to work.  Static if seems like a much cleaner way to do things.

If it is intended to have more than one templated definition that could match, I'd prefer to see D try to instantiate all candidates, and ensure that all but one instance has an error.  If more than one matches successfully, the code wasn't coded well enough.  If all throw an error, then the respective errors for each are printed and allows the user to see what's going wrong with each candidate.




More information about the Digitalmars-d mailing list