Hacker News new | ask | show | jobs
by BoorishBears 2741 days ago
I both admire Elixr for making Erlang “cool” and detest it for ruining my single most favorite part about the language, it’s simplicity and clarity.

There’s only one way to do a given thing and you can learn each of the things the syntax can do in a weekend.

It was my first non-C-like, non-assembler language and I loved it.

3 comments

When I give talks about Erlang I usually say I can teach the syntax in about 5 minutes. An exaggeration, but not a dramatic one.

I too vastly prefer Erlang’s syntax to Elixir’s. It helps me think like Erlang, and most of my functions are just a few lines long. Thanks Garrett[0].

[0]: http://www.gar1t.com/blog/solving-embarrassingly-obvious-pro...

My sentiment exactly :)

I'm grateful that Elixir is putting Erlang under the spotlights. That it is doing a lot to conveying all the Erlang/OTP concepts and practices. But each time I use it - and I know I may be the odd duck based on slack, blog posts, etc - I feel like the syntax is so complex, with 4 different manners to write the same thing. And I'm not talking about "ways to do things", but literally syntactic ways to do the same thing.

> literally syntactic ways to do the same thing.

Yup! They are not that many though (6 rules) and they are all documented here: https://hexdocs.pm/elixir/syntax-reference.html#syntactic-su...

Does the shorthand lambda belong on this list?

Thanks for all the work!

Oh, that's a very good question! It doesn't because the list linked above is about syntactical equivalence and the shorthand `&` has its own AST. But now you made me wonder if we should add it to the list anyway (with a caveat) as it would make the list more complete.
I think those more complicated things are there to make things easy for developers. The standard library is not that big, and the extra syntax is there for a reason - for example `with` is pretty fantastic for reducing `case` clutter (a real thing with erlang), and pipes are also great.

I don't love that there are two ways to make lambdas but it's nit the worst thing in the world.