Elixir compiler checks

After using Elixir for a while, i have a feeling that i don’t get the same kind of water tight compiler checks that comes with languages like Haskell or Scala. Is this mainly because Elixir is not a strongly typed language?

Sometimes i have a spelling mistake and only find out during runtime. And sometimes the spelling mistake is quite difficult to spot (maybe i am not sharp enough).

1 Like

It is because elixir is not a statically compiled language. Elixir is a
strongly dynamically typed language.

You can’t have the same guarantees as Haskell or Scala which are not
only both statically and strongly typed but also use a more advanced
type system than other statically compiled langauges like golang or java.

With elixir and other dynamic languages you need to rely more on testing
to catch errors such as spelling mistakes and type mismatches.

With elixir you do have dialyzer which can provide a little bit more
guidance but nowhere near haskell. In my experience, elixir with
dialyzer will give you the same feeling of type safety as golang or
java.

3 Likes

While this is not a solution to catching the mis-spelling problem early, having an editor that supports auto-complete on variable names/functions helps tremendously in avoiding the problem in the first place.

If you aren’t typing a few letters and then hitting tab, get an editor that will do that for you in Elixir.

Also fully endorse Dialyzer. Compilation will complete but you’ll get warnings.