Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

OK, I see your point. Of course, the type system will not substitute this kind of tests. But it allows you to check the whole range of values. This is helpful if you e.g. wanted to handle overflows, wanted to limit the operands to positive numbers, etc.


Not only will the type-system not substitute these types of tests, but also the reverse: you just don't write tests for types, as they are subsumed by the value tests, which is why I object to the canard of "the type system saves you from having to write trivial tests for types".

And yes, a type-system can do certain types of "forall" analyses that are difficult or impossible with tests, but that's a different topic.


> you just don't write tests for types, as they are subsumed by the value tests

I think this is false.


The fallacy is assuming people write tests.

Regardless of what gets preached at agile conferences and such, the reality is that in most enterprise projects, the amount of tests is close to zero.


It's also more important.

Generally with tests, you're less concerned about having some particular examples succeed, than you are with finding if there are possible values that fail.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: