by _dain_ · 2y ago · 0 comments
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.