C++ guys hate static_if?

Walter Bright newshound2 at digitalmars.com
Thu Mar 14 13:10:28 PDT 2013


On 3/14/2013 11:04 AM, H. S. Teoh wrote:
> But that was my point, if we had concepts, then the compiler could
> statically check the syntax of the template without needing to iterate
> over all combinations of types.

A syntax check is not a semantic check.

> Right now, we *have* to essentially check all combinations in unittests
> if we want to be sure that the template is instantiable in all cases.

You have to anyway.

Consider functions. Just because the function passes syntactical and semantic 
checks does not at all mean it passes with all combinations of parameter values. 
We still need unittests, and while unittests also do not guarantee the function 
is correct in all cases, it is considered unprofessional to ship a function that 
was never called at runtime in any tests.



More information about the Digitalmars-d mailing list