3 ms·
> What good is having a int type if you can't limit its range? Well then you don't have to test what happens when someone passes a string, an object, or a bool
by wvenable 10y ago
> What good is having a int type if you can't limit its range?
Well then you don't have to test what happens when someone passes a string, an object, or a boolean. Most dynamic languages will silently convert many of these values into an int and produce incorrect results.
> I'm not going to maintain BOTH static types and tests.
You have to maintain documentation and you have to maintain tests and you have to maintain assertions for the implied types of your functions anyway so you might as well make them explicit in the code.
- jeremiep 10y ago> Well then you don't have to test what happens when someone passes a string, an object, or a boolean. That's useless, I still need to test the value's range which implicitly checks the type. > You have to maintain documentation and you have to maintain tests and you have to maintain assertions Not if I can generate most of it from the specification data.