Re:Why Crystal Is My Next Language
by atombender on Tuesday June 12, 2018 @06:24PM
(#17298629)
C is not a great example here, because it's somewhat weakly typed. But it's true that typing doesn't fix the identical-arguments problem.
Type checking only works when you make a mistake which breaks a type signature. You can call entirely the wrong function with the right type signature. You can call sin instead of cos, or forget to take a log of something. You an swap the arguments to a subtraction: both are floats. Think of all the numeric code in which lots of variables, arguments, array elements and so on are all of the same type. Or string code in which there are numerous strings. Or OOP code where you have two or more objects in the same scope of exactly the same class, which can get mixed up.
The idea that you do not need a comprehensive test suite because you have static types is horribly wrong.