Static typing for Erlang

With the new set theoretic type system coming to Elixir, and the fact that this project exists:

does this mean static types could be coming to Erlang at some point in the future?

im mostly interested if static types would help with performance at all. Talking to people who work on python, apparently types don’t really matter to python performance at all, but the BEAM and CPython are quiet different

There a few different Erlang type checkers, in addition to etylizer (and dialyzer which is part of Erlang/OTP):

  • Gradulizer - I got somewhat frustrated with this one, as it was hard to fix certain type warnings. There where no escape hatches to e.g. mute certain warnings or to assign a specific type signature when it failed to resolve types properly.
  • eqWAlizer - haven’t tried this one, mostly because I was working on older Erlang code bases (at the time I looked into it) that required older Erlang/OTP versions that weren’t supported by eqWAlizer.
  • One could also run dialyzer with more strict flags (compared to the default).

I’m obviously biased here as one of the co-maintainers of eqwalizer, but here’s my take on the current landscape.

  • Dialyzer is long-standing and part of OTP. It’s actively used by large swaths of engineers on very varied codebases. However, it’s ability to detect issues is relatively limited and overall behaviour rather un-intuitive, the error messages leave often a lot to be desired, and it’s know for being slow.
  • Gradualizer is, by project’s own description, pre-beta quality, and at this point I don’t think it’s ready to be used at scale
  • Etylizer is, IMO, not yet fully ready for large-scale adoption - it has some performance issues and not all language constructs are fully supported yet.
  • EqWAlizer is actively supported by a team of couple engineers, it’s used in production by really big teams on a massive codebase, however it hasn’t been subjected to a lot of codebase variety. It’s under active development with IDE support (via ELP), and weekly updates and improvements. The main “missing” part is probably the documentation and there might be rough edges running under rebar3 since it’s not our primary build tool.

I’d recommend giving eqWAlizer a try, and we always welcome any help in making it more “ready” to be used easily in standard community projects.

i am also biased here (because i develop on FreeBSD), dialyzer, gradualizer and etylizer run on beam (and are therefore usable wherever beam runs).
EqWAlizer requires GraalVM (well not really, you could get away with a JRE … but GraalVM and interfaced by ELP is the documented method to use it).

Yes, the setup is more complex and that is indeed another downside. We do eventually hope to only require Rust & BEAM, but this will take a while to materialize.