Comment by ohmahjong
2 months ago
As someone curious about learning more about type systems, would you mind elaborating on 1.? I'm assuming you mean the formal definition of "sound", not just as a synonym for "sensible". Sound typing is often something handwaved away as not being particulary consequential in practice; what benefits have you seen there?
It's not particularly consequential when the types are only used for type checking and then thrown away. That's how Typescript and Python work.
But when the types are sound you can use them to compile better code. That's what most languages with "proper" static types (not just type hints) do.
From the official website: > Dart enforces a sound type system. This means you can't write code where a variable's value differs from its static type.
I know you didn't ask me but I think that not ensuring soudness is a feature because it allows the type system to wrap something that could work without it. Would you like unit tests if removing them would break your code? Maybe it's not a fair comparison, or maybe it is...