3 ms·
Well, this is why I mentioned TDD. People (maybe not you) don't have a problem with their tests failing right away, and having to fix the test to go forward.
by kscaldef 17y ago
Well, this is why I mentioned TDD. People (maybe not you) don't have a problem with their tests failing right away, and having to fix the test to go forward. In fact, they call it a feature! But when the compiler _proves_ you have a bug, somehow that is too odious.
The other thing with a type-inferring compiler is that you don't have to figure out all your types upfront. You don't have to declare any types at all (usually). If everything is good, the compiler doesn't complain. As soon as you start to make an error, it tells you. Personally, I use the compiler very much like TDD advocates use tests. Write a function, make sure it compiles, slowly build up the whole program. If I wait until I've written the whole program before I run the type-checker, it's likely to be pretty ugly. Better to catch the errors quickly when it's less work to correct them.
- silentbicycle 17y ago> The other thing with a type-inferring compiler is that you don't have to figure out all your types upfront. I've worked a fair bit with OCaml. You still need to define types for ADTs, and those can change early on. I think the bigger benefit to inferred static typing is during maintenance, ensuring that the design is still internally consistent. I mostly agree with you, and have the same experience about TDD vs. type inference. I'm not dogmatic about TDD either, though - I use a REPL and asserts, and sometimes QuickCheck-ish tools for testing during the initial writing.