Not to mention peace of mind when you go and mess around with code you wrote 9 months ago - if you mess up or didn't think of a corner case, there's decent chance it'll get caught by existing tests.
In practice, when you write those tests for where the type system is lacking, you end up also incidentally testing where there is type system coverage, so there likely isn't much for industry to talk about.
Well, you are currently participating in a thread that discusses this very question so there's that... and such threads are regular on HN.
I meant just that. People discuss it. What you want to say is that you have a strong opinion about it, that's OK and still possible with open questions
("For free" in scare quotes because of course there are always tradeoffs between different programming languages.)
https://www.cs.utexas.edu/users/EWD/transcriptions/EWD02xx/E...
Depends on the language and the business logic. Types are a way of specifying preconditions and postconditions; a more expressive type system lets you rule out more edge cases by making illegal states unrepresentable.
In particular, I'm pretty sure it's not possible to have the thread bug from the article in Rust's type system.
For instance in a method that absolutely requires a specific type of object as a return, setting up a sacrificial default value to have the compiler happy, and actually build the inners of the function from there would be a normal course of action. That lets us run the code as we build it. But at the end if you forgot a case, it will still be a bug, except instead of having a wrong return type you get a wrong value. Weither it's better or not is up for debate.
You should probably clarify that it’s not possible for you to write non-trivial programs in Rust.
And that’s okay! No one comes into this world knowing how to do any thing, but we can all learn if we choose to.
If you have a particular sticking point, I’d be glad to give advice.
Is Servo non-trivial? I think yes.
So you save a “ton of time” writing the code without “cognitive overhead of types”, then you spend 3x as long writing the tests
Not true. Even today the majority of security bugs are simple buffer overflows, for example. The subtle bugs are more memorable, but that doesn't mean they're actually more common.
> major bugs are "this combination of preconditions yield a business logic edge case that wasn't accounted for". Static typing doesn't really help more than dynamic typing in these cases.
It absolutely does, if you put a little bit of effort into actually using it. Represent your business logic invariants in the type system, then the compiler won't let you accidentally violate them.