Re:Why Type Systems Matter
by lliamander on Friday August 18, 2017 @04:01PM
(#15049290)
I've worked in an modest Erlang codebase (~30k LOC) with a couple other people, and we used dialyzer pervasively with pretty good success. I would actually say that in some ways it was an improvement over Java's approach to types:
* 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.
* 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.