5 ms·
I used Erlang before Elixir and it was awesome, albeit with a syntax that required getting used too. I've often looked at bridging the gap between Ruby and Erla
by andruby 8y ago
I used Erlang before Elixir and it was awesome, albeit with a syntax that required getting used too. I've often looked at bridging the gap between Ruby and Erlang, and closely watched and tested solutions like Reia [0], Erlectricity [1] and Ernie [2].
I was delighted when Jose started getting involved in the space and released Elixir. Thanks Jose!
[0] http://reia-lang.org http://reia-lang.org
[1] https://gilesbowkett.blogspot.com/2007/05/erlectricity-erlang-ruby-bridge.html https://gilesbowkett.blogspot.com/2007/05/erlectricity-erlan...
[2] https://github.com/mojombo/ernie https://github.com/mojombo/ernie
- sb8244 8y agoErnie was my first foray into Erlang (run many production elixir apps now). It's still humming along in one of our legacy services. Never had an issue or downtime event
- dudul 8y agoElixir's syntax may look more aesthetically pleasing than Erlan's, but Erlang's is way more consistent and simpler once you get used to it/understand the rules.
- BoorishBears 8y agoI 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.
- dudul 8y agoMy 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.
- josevalim 8y ago> 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-sugar https://hexdocs.pm/elixir/syntax-reference.html#syntactic-su...
- dnautics 8y agoDoes the shorthand lambda belong on this list? Thanks for all the work!
- josevalim 8y agoOh, 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.
- macintux 8y agoWhen 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-problems-in-erlang.html http://www.gar1t.com/blog/solving-embarrassingly-obvious-pro...
- dnautics 8y agoI 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.
- josevalim 8y agoWhat makes it interesting is that the syntaxes have (most likely) been designed with different goals. I can say that Elixir was designed with extensibility and meta-programming in mind. So there are some cases where I prefer the Erlang syntax (for example, I still find defining multiple function clauses each with a single expression more elegant and concise in Erlang) while there are other cases I prefer Elixir's syntax exactly because we were able to extend the language (such as the `with` special form for handling nested case expressions). The funny thing is, if you try to add those features to the other language, they are usually refused. Erlang wants to avoid new syntactical expressions to keep it simple while Elixir's extensibility is bound to a set of limited AST rules (and we don't want to add new ones).
- macintux 8y agoThanks, somehow I’d missed Reia in my list of BEAM languages. https://gist.github.com/macintux/6349828 https://gist.github.com/macintux/6349828
- macintux 8y ago(Incidentally, when did Github break gist editing? I can no longer paste using my soft keyboard on my iPad.)
- the_clarence 8y agoIs Elixir more than just a ruby syntax of erlang? Because I prefer Erlang’s syntax.
- hellbanner 8y agoThat'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.
- pmarreck 8y ago> 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.
- schpaencoder 8y agoYou have macros in Elixir
- PopeDotNinja 8y agoErlang has macros... http://www1.erlang.org/documentation/doc-4.8.2/doc/extensions/macros.html http://www1.erlang.org/documentation/doc-4.8.2/doc/extension... ...but I think they work differently, or are more limited in scope.
- ramchip 8y ago