[erlang-questions] Why Learn Elixir if it's built on Erlang? Why not just learn Erlang?

Aaron Seigo aseigo@REDACTED
Tue Feb 13 09:25:42 CET 2018


On 2018-02-13 03:48, Hakim Fajardo wrote:

> I've been spending time teaching my self Elixir and Erlang. But I can't help but ask why learn Elixir if's built on top of Erlang? Why not just learn Erlang. I enjoy learning both but what's the point?

I really enjoy both languages for being the mix of pragmatic FP and the
wonder that is OTP that they are. So it is easy to understand how people
fall into liking one or the other language more: the important stuff is
common, it's the details that make up the differences. 

There are things that Elixir brings with it, though, that are hard to
replicate with Erlang on its own. There are lots of little things (like
multiple modules in the same file, not having to name source files after
modules, and visibility of functions attached to the function
definition; all products of the times when Elixir and Erlang were
"born") which probably aren't enough on their own to really warrant
making a choice. 

The big things that do make the difference, at least for me, include the
tooling (which is hands-down nicer in Elixir, even though rebar3 with
hex.pm support has helped a bit), testing framework, macros, the more
pleasant APIs (compare Erlang's map with Elixir's Map, for instance),
and the libraries / projects like Ecto, Phoenix, Flow, Nerves, ...  

I still use a lot of pure-Erlang libraries (so many good things! :), but
many of the nicer Elixir libraries would be hard to replicate with pure
Erlang. Ecto and Plug are good examples as they both rely on macros
quite a bit to make them as easy to use while remaining powerful. 

So, for me, that's the reason to use Elixir. Being able to use Erlang
code with Elixir code is a pure godsend, though, and I still write
Erlang where it makes sense to do so :) 

-- 
Aaron
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20180213/6693f847/attachment.htm>


More information about the erlang-questions mailing list