by jpcooper · 5y ago · 0 comments
And types like machine types are of course irrelevant for BEAM, well, maybe they'll start to matter a bit with JIT, but probably still not, BEAM with JIT is still not going to be a performance miracle.
However, by themselves, strong types do not provide proofs.
See the following for proofs of strongly-typed concurrent systems:
https://papers.ssrn.com/abstract=3418003
Strongly-typed programming languages need to provide
additional capabilities for error processing and recovery.
for messages by having the type system do crypto so that
applications can benefit without requiring application
programmers to manage keys and crypto code.
That said, our own practices meant we included a lot of unit and API level tests, and some of the issues I personally caught and fixed when testing might have been avoided by typing, and were, eventually, when we added Dialyzer about a year and a half into the project.
Dialyzer itself was worth it to me only insofar as type specs gave me a language to express the typing I was going for, rather than leaving it implicit. It also helped me understand what my colleagues were trying to do in some cases. The explicitness helped me feel better about what I was doing as well; in hindsight I don't think it sped up development, nor did it reduce bugs (though it likely reduced testing time...but that's probably a wash given the time to get the spec right, and update it as data structures evolved).
Can't speak to using another language on the BEAM, whose typing isn't optimistic like Dialyzer, but my experience with Dialyzer, at least, left me feeling subjectively better about the code, but objectively and in hindsight I don't feel it gave us measurable improvement. Just more confidence. Which may be enough of a gain; confidence in the system is what you want when you're optimizing for reliability, even if it's not really a gain on that front.
Attempts are being made to graft types onto Erlang. However,
they are limited by compatibility requirements with existing
large existing programs and libraries :-(