|
|
|
|
|
by wutbrodo
3233 days ago
|
|
> Good post, but note all those things you don't need a statically typed language. > Python has that too with MyPy. I don't know much about Erlang's typing, but this claim is definitely untrue. I run a code base with five engineers and I'm pretty disciplined about asking for type annotations wherever appropriate, and I still miss static typing every damn day. The grafted-on approach is definitely beneficial, and I frankly don't understand how people ran Python engineering projects of any significant size without it, but it has just enough holes in it that the type inference chain breaks often (ie just drops to type Any). It also gives false positive errors just often enough that it lowers your sensitivity to real errors. Don't get me wrong, I'm happy it exists. But Python with types is a poor imitation of a proper engineering programming language. |
|
* there is no implicit 'null'. I.e., if your type signature doesn't explicitly include the value "none", then it's not allowed
* you have union and intersection types
* it's super easy to create new records (and types from those records)
* even if your type signature is structural, you can optionally give more meaningful names to arguments and return values in the signature itself
* success typing is still good enough to catch many "uninteresting" bugs (which I consider to be a significant advantage of static typing. When I fix bugs, I want it to be bugs with my understanding of the requirements, not bugs with my understanding about the values returned/expected by a function)
pattern matching also helps clarify the expected values of a function.