Erlang over Elixir

This post will go over why I've decided to use Erlang instead of Elixir for my application (typically web app) needs. I've been meaning to write this post for years and finally decided to do it.

One night, I couldn't sleep, and I had this haunting feeling to try Erlang again for fun.

I liked the BEAM but had been feeling dissatisfied with Elixir. I had also been coding in C at the time. Erlang's syntax always feels like an alien language, but in a good way. Like an advanced technology that was lost. In regards to programming language family trees, Erlang is unique. The closest family member is Prolog. Erlang was implemented initially with concurrent Prolog. However, Erlang is not faithful to Prolog. Erlang is unique.

Elixir isn't that far from Erlang. So why not simply code in Erlang?

What's funny is that I had written a post about why I was switching back to Elixir. That choice would've still been wise, but now I like Erlang more. It speaks to me. It makes me happy. I should stop making posts like this as they don't seem to age well.

Minimalism and Zen

Erlang is a minimalist language; Elixir is a bit less minimalist. I'm a minimalist. I prefer explicit over implicit.

While Elixir is significantly more minimalist than Java or C++, it has a TON of features. That's great when you need them. Unfortunately, the Elixir community has adopted these features where they aren't needed. I feel the rampant user of protocols in Elixir is a bummer. Protocols are the "proper" way to do Elixir, yet they don't provide all that much value.

A few times with Elixir, I felt like I still didn't know the whole language. Despite programming in it for a few years. I've had similar feelings with Rust, which has caused me to do a lot more C and look into Zig recently.

Readability (I hate macros)

One of my favorite features of Erlang is readability. Someone used to Javascript code will not feel at home in an Erlang codebase.

BUT!!! Once familiar with Erlang, you can jump into any codebase and grok what is going on. I don't feel this way about a lot of languages.

Golang is one of them. Begrudgingly I would say Javascript can be. Erlang is one of them. I wouldn't say the same for Elixir.

Elixir has the same problem that lisp has. Macros. Macros can be helpful, but I believe they are glorified code generators. This advantage can be achieved in other ways, like compiler plugins, without obscuring the semantics of the code.

Coming from Clojure, I enjoyed the piping operator. However, I don't feel it always helped with code legibility. Erlang can sometimes be a little imperative, but the semantics are usually crystal clear. I can live without it, and I'm not sad.

A former Rails engineer designed Elixir. No surprise that the language and the culture lean on automagic.

Renaissance

A great thing about Erlang is that it still has a vibrant ecosystem. Seriously, it is good enough. It may have gotten a tailwind from the excitement around Elixir. I can personally attest to that. I wouldn't have known about Erlang had it not been for Elixir. rebar3 makes contributing and leveraging the Erlang ecosystem trivial. The new Erlang Forum has been a great resource.

I've made a cowboy middleware, raised issues for bugs, and even submitted patches for a few of them myself.

I've heard some rumblings that people are switching from Kotlin to plain Java. Maybe something similar can happen with Erlang. I'm excited to see the future.

Conclusion

I want to reiterate that you aren't a dummy if you choose Elixir. It is a safe bet.

I had a change of heart. Erlang might be for you if you like the BEAM and are minimalist.

Content for this site is CC-BY-SA.

More Posts