Type Systems
For better or worse, one of the most commonly asked questions by developers coming from another language is whether Elixir provides types support. The common argument is that static types defined in an application allow for more predictability and guarantees about how an application will perform. (Whether those claims are true or not is a matter of opinion.)
Many Elixirists take advantage of pattern matching and structs to achieve a loose version of typing. If you use a struct match like message = %SmsMessage{} in your function head, then you know that message will be an SmsMessage. This actually goes a long way, but it’s not a true types support.
Dialyzer is an Erlang package that provides a “success typing” implementation for ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access