Are there things Elixir can do that Erlang cannot, or vice versa?

Saša Šijak picture Saša Šijak · Jun 22, 2016 · Viewed 29.1k times · Source

This question is in the context of the Beam VM and the capabilities that it provides, not in the general context of what a Turing complete language can do. I want to invest some time to learn either pure Erlang or Elixir. I get the basic differences between the two and I am leaning towards Elixir because of the macros, better syntax and faster development of the language this day.

My question is: if I choose Elixir, will I stumble on something that I cannot do in it, but can do in Erlang? Can I use all the OTP stuff, all the Erlang libraries, code reload, etc. with Elixir?

I am not asking for someone's preference between the two; just facts about the possibilities of the languages. Preferably from someone who used both in production.

Answer

Paweł Obrok picture Paweł Obrok · Jun 22, 2016

You shouldn't stumble on anything you can do in one that you can't in the other, since you can freely call Elixir code from Erlang and vice-versa. You can even easily mix Erlang and Elixir files in one project.

In Elixir:

:erlang_module.erlang_function(args)

in Erlang:

'Elixir.ElixirModule':elixir_function(args)