Language choices

Just a question out of curiosity, because while diving more and more into aeternity I noticed the choice for Erlang and Elixir. I fully understand why the project picked these languages.

Now while experimenting a bit with Erlang and Elixir I got the impression that Elixir can do everything Erlang can do, but not the other way around. Please correct me if that is a false statement.

So I’m curious about the philosophy behind the choice of Erlang and Elixir for the various parts within the aeternity project. For example: Why epoch is written in Erlang and not in Elixir for example? And for which parts Elixir should be preferred above Erlang?

1 Like

You need to realise how Elixir and Erlang relate to each other. Elixir is basically a skin on top of the Erlang/OTP system, sometimes a thin skin and sometimes a thick skin. For example Elixir compiles to Erlang. This means both that anything you can do in Erlang you can do in Elixir and anything you can do in Elixir you can do in Erlang. So in one way you are free to choose which language you prefer.

This is actually a strength as it allows you to mix code and use packages from either language together.

Which you language you prefer is very individual, and the cause of multiple syntax/language wars which help no one. I personally prefer LFE. :grinning:

7 Likes

I am lead of the Elixir developer team.

First thing to realize is, the Erlang æternity implementation, is the reference implementation of the æternity protocol for now. It leads in terms of features, security and stability. Also it will be the implementation to be used for mainnet release. It was choosen as we did have a great team for Erlang.

æternity will provide an alternative implementation of the protocol in Elixir. This is done for 3 main reasons:

  1. The Elixir implementation will focus on easy to read and understand code. Elixir tends to be a simpler language to understand in terms of syntax and structure, for developers not yet familiar with the Erlang/OTP ecosystem. So it will be better approachable by new developers interested in the æternity protocol.
  2. The Elixir developer team is more junior, compared to the Erlang one, we wanted them to get æternity protocol experts, by implementing it themselves, not just translating Erlang, to some other language.
  3. An alternative protocol implementation is a good thing to have in the blockchain space. We can use the Elixir implementation, to check if the network of Erlang nodes complies to the protocol. Once both nodes are released for mainnet, it will provide more stability and safety, in case one of them has performance problems or other vulnerabilities. E.g. one node crashed while validating some malicious block, the other implementation probably won’t have the same issue.

Thank you @rvirding for the great general answer to the Elixir/Erlang design and ecosystem.

6 Likes

Thank you both for the detailed answers and also for the article which was recently posted on the aeternity blog about this. What you’re saying makes perfect sense to me. I already started experimenting with Erlang (which reminds me a of Prolog BTW) and will take a look at Elixer as well.

3 Likes