Hacker News new | ask | show | jobs
by melling 2542 days ago
If you search HN history, it appears Elixir seems to get much more buzz. Saw this from a few days ago:

https://news.ycombinator.com/item?id=20357055

Elixir is just a slightly changed Erlang syntax?

3 comments

Elixir has a homoiconic syntax and hygienic macros, like a Lisp. In fact much of the user-facing syntax of Elixir is just macro definitions. You can do a lot of things with it at compile time, and people take advantage of it to do really cool things like compile Phoenix routes down into a single static dispatching function so that requests can be routed quickly.
Could you expand on what you mean by Elixir being homoiconic? That doesn’t seem readily apparent to me, and is contradicted by posts such as http://www.petecorey.com/blog/2017/08/07/what-if-elixir-were...
Yup you're right, my bad–I mixed up homoiconicity and hygienic macros–apparently like many before me!
Cleaner syntax, macros and a whole lot of developer productivity focused tooling.
Disagree with “cleaner”.
Syntax is a subjective concern for sure. My experience has been that Erlang takes a little more effort and time to read fluidly, but only when first learning. I think this is because Erlang uses visually subtle tokens for important language distinctions (upper vs lower caps and periods being the primary culprits). Now that I've spent enough time in the ecosystem reading Erlang isn't really a problem, but Elixir's syntax felt like it took less mental effort to read when starting out.

I think Elixir making different token choices for these distinct ideas is the main reason for readability improvements. Especially since Erlang has less different tokens overall which you'd think would help reduce the noise.

It'd be nice if dissenting opinions came with elaboration to continue the discussion instead of shut it down.
The dissenting opinion that it has "cleaner" syntax came with no elaboration.
Disagree with "disagree"

...see where that leads us? Please actually voice reasons how it's not cleaner, as it's most definitely less verbose, And having less clutter is generally seen as cleaner

The original claim is just as pointless. The implication that Elixir fixes Erlang's syntax is so commonly repeated without much discussion that it has many folks dismissing the entire language before they learn it.

I think both languages have issues with Syntax but in the cleaner department, I am baffled at the insistence that Erlang is hard. Inconvenient, maybe but most of the features in Erlang are so primitive that there is little to no ambiguity of what something can mean.

Verbosity strikes both (records and binaries in Erlang vs the sigil and keyword heavy Elixir code) and certainly some folks prefer rebinding variables and colon syntax on atoms but it's certainly not without real trade-offs in common idioms (tagged tuples, special casing required for atoms like true, false, nil, interop with Erlang becomes uglier, etc).

It’s more verbose when defining functions, calling anonymous functions, and referencing atoms.

Calling functions with and without parens makes for a less clean syntax. Less consistency (plus mandates the dot notation for calling anonymous functions).

> It’s more verbose when defining functions, calling anonymous functions, and referencing atoms.

and we're finally finding out how both opinions are correct

when people say that elixir code is cleaner, they're normally talking about the significantly reduced amount of code they have to write because of the macros. its not specifically about how they're defining a function or calling them anonymously

while i cant say that i agree with atom reference, (its 1 char in elixir, two in erlang), you're definitely correct about that annoying idea they've had about dropping parenthesis on functions without parameters... that was just misguided i think.

Using an atom doesn’t require any extra characters in Erlang. Update: just realized you mean the single quotes when you need an arbitrary atom name. Understood.

I definitely wish Erlang had the same macro capability. I just find the overall syntax sufficiently unpleasant that I can’t get into Elixir.

Elixir is a language that compiles down to bytecode that runs on the BEAM VM.