C++ guys hate static_if?

deadalnix deadalnix at gmail.com
Thu Mar 14 09:54:37 PDT 2013


On Thursday, 14 March 2013 at 16:48:29 UTC, Andrei Alexandrescu 
wrote:
> And it has been made indeed. The question is on agreeing or not 
> with specifics. The stereotypical argument in favor of dynamic 
> typing goes as follows:
>
> Q: Does static typing detect all bugs?
>
> A: No.
>
> Q: Then unittests are necessary.
>
> A: Correct.
>
> Q: So if static typing is insufficient, why not rely on 
> unittests alone to do all checking? It's also bothersome for 
> some people to obey types, annotate stuff etc.
>
> A: There are still errors that can be better detected with 
> static checking, and many dynamic programs that work by 
> accident etc.
>

I see we agree this is the same problem materialized in another 
form. I find it rather weird that you conclude different things 
when the problem is the same in the first place.

>> I don't say that unittest are useless, but why rely on 
>> unittest when the
>> machine can do the job for you ?
>
> In both cases the machine does the work. 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.
>

I have other benefit, as the capability for the compiler to give 
understandable error message instead of a wall of template errors.

This is clearly not a priority anyway. We should stop building on 
foundation that aren't solid or everything will collapse.


More information about the Digitalmars-d mailing list