Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Is Elixir more than just a ruby syntax of erlang? Because I prefer Erlang’s syntax.


Elixir is more than syntax. Or rather, it is not even about the syntax :) This is a common question, so I even gave a talk about it some time ago: https://www.youtube.com/watch?v=V5fMQcSy3y8

Elixir features meta-programming, structs and protocols, first-class documentation, strong focus on the tooling, some abstractions that make concurrency more accessible (such as tasks and streams), etc.

However, Erlang and Elixir share a lot! They have the same data-types (with the same names and even the same syntax for almost all of them), the runtime is the same, and the same foundation about processes, fault-tolerance and distribution.

My suggestion is to go with whatever "touches your heart" because, even if Elixir has its own features, they are more alike than they are different and most concepts you learn for one will also apply to the other.


> They have the same data-types (with the same names and even the same syntax for almost all of them),

As someone who mostly has just used Erlang, but has looked at Elixir some, I think one of the things I appreciate about Elixir is some of the Erlang warts that you've managed to work around, like having strings be Erlang binaries.


I agree with davidw, 100%


That's mostly it. Personally I find Elixir's syntax confusing. For example:

Losing the ; and . function endings from Erlang you can put same-named functions throughout your module. I tried doing

def create def handle(:create)

def update def handle(:update)

But the compiler warns. So that loss isn't helpful.

Atoms require a : because variable names are lowercase.

Uppercase variable names and lowercase module names is easier to read in Erlang.

The syntactic sugar is too clever for readability imo.

The package management through mix is decent. I used to use an erlang.mk file, looking at hex it looks like the Erlang ecosystem is quite evolved.

Phoenix + Ecto seem to be very actively maintained, useful if you're writing web apps.

When I tried Cowboy a few years ago some of the documentation was out of date, so that's a point in Elixir's favor.


> Uppercase variable names and lowercase module names is easier to read in Erlang

This is ENTIRELY subjective and not a rational argument. It's in fact the exact opposite for me, but my prior language was Ruby.


Can we please have one BEAM thread where this isnt brought up? Its such a minor thing. I went from erlang to elixir and whilst at first I really missed atoms that start with a colon, you get used to it. Its 90% the same ideas, and Elixirs pipe operator is worth any small syntax niceties erlang has. No language is completely without its quirks even erlang (unless you LIKE endless repituons of the same variable into var_1, var_2, etc - and no, this doesnt reduce bugs http://blog.plataformatec.com.br/2016/01/comparing-elixir-an... )


You have macros in Elixir


Erlang has macros...

http://www1.erlang.org/documentation/doc-4.8.2/doc/extension...

...but I think they work differently, or are more limited in scope.


Erlang macros are basically text substitution. It's similar to C pre-processor directives.

Elixir macros are a completely different beast, they can manipulate the AST Lisp-style. A very elegant example is Elixir's unicode module, which reads unicode data tables and turns them into function definitions at compile time [1].

Compare this to the equivalent module in plain old Erlang, which has to be generated by a separate script, in a pre-compilation step in the Makefile, that literally prints blocks of code [2].

[1] https://github.com/elixir-lang/elixir/blob/v1.7.4/lib/elixir...

[2] https://github.com/erlang/otp/blob/OTP-21.2/lib/stdlib/uc_sp...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: