C++ guys hate static_if?

bearophile bearophileHUGS at lycos.com
Thu Mar 14 10:07:10 PDT 2013


Andrei Alexandrescu:

>> This is usualy much better to have the compiler smash your 
>> mistake right
>> into your face than discovering with a unittest much latter.
>
> I don't think so.

Why?


> My argument is that adding an additional layer of typing on top 
> of templates caters to people who want to ship code that has 
> literally zero testing. That's not a priority as far as I'm 
> concerned.

If those people want yo write zero unit tests, they will write 
zero unit tests in both cases. I have seen D code like that. 
Introducing some compiler tests isn't going to make that 
situation worse and it's able to give better&nicer error messages 
when you have just written a template and you have not yet 
written a unittest (assuming you aren't using 
Test-Driven-Development).

A template unittest often doesn't cover all possible 
instantiations of a template. So some compiler tests that work on 
all possible instantiations can help.

You can also look at the situation from the other way: assuming 
you are correct, what currently present compiler tests do you 
want to remove?

Bye,
bearophile


More information about the Digitalmars-d mailing list