5 ms·
Can someone explain why I should use Elixir instead of Erlang? I haven't used either, but from a very high level it seems that Elixir has a "magic" syntax like
by nilkn 10y ago
Can someone explain why I should use Elixir instead of Erlang? I haven't used either, but from a very high level it seems that Elixir has a "magic" syntax like Ruby, where as much as possible is hidden from the user, whereas Erlang has a much clearer and more concrete syntax. Even though Erlang's syntax is not standard or traditional, as someone who's used neither neither language, I find it much easier to read and understand exactly what's happening.
- bratsche 10y agoI don't think anything is hidden, it's just a different syntax. The only thing that's really changed is that in some of the Elixir modules they've changed the order of parameters to make them consistent. I use Elixir and I like it, but I wouldn't tell you to use Elixir over Erlang. There's no competition, what's good for one language is good for the other. So use whatever makes more sense to you and hopefully all of us in this Erlang community win.
- mijoharas 10y agoI've only dabbled with both, but the reasons often given is that (apart from surface syntax) the advantages of Elixir over erlang is a powerful macro system, a more cohesive standard library (with some nice things like the pipeline operator), and some very nice tooling (mix is great). With all that being said, erlang is a great language as well, so just pick whatever you like the most. Here is a short article that outlines some advantages. http://theerlangelist.com/article/why_elixir http://theerlangelist.com/article/why_elixir
- learc83 10y agoRuby doesn't really have "magic" syntax anymore than any other dynamic language does. Too much "magic" is a frequent criticism of the Rails framework, but I've never heard that directed at Ruby.
- illicium 10y agoPhoenix is filled with macro magic, and just like Rails is the overwhelming reason to use Ruby, is pretty much the main reason why people pick up Elixir.
- pdimitar 10y agoAnecdotal evidence: meta-programming and class monkey-patching in the gems I am putting in my Rails projects has been a steady source of WTFs for me over the years. These are awful techniques IMO but I can't deny that they are life-savers in the Ruby land sometimes.
- innocentoldguy 10y agoElixir has a cleaner syntax that I find a lot easier to read and work with (subjective), and it has powerful macro capabilities that make it possible to do metaprogramming (objective). There's nothing "magic" about Elixir syntax, and it is easy to interface with Erlang libraries.
- rdtsc 10y agoI use Erlang primarily and like it better -- as you said, there is a bit less magic, things are more explicit and it is the primary target language of the VM. Some people like one syntax, some the other. Elixir has some constructs like pipe and in some cases macros can be nicer, don't feel like I need them and am quite happy using Erlang. I rather like that syntax is not like Ruby or Python or other language I know, it helps my mind switch contexts. So that is a personal choice. Also Elixir has very welcoming community for beginners. That's big bonus if you are starting out, but Erlang also has more existing literature, books and learning materials. Take a look at both and see which one appeals more to you. At the end of the day, they both use the excellent BEAM VM and you'd end up learning largely similar concepts anyway.
- out_of_protocol 10y agoIt's not about syntax, it's about * Dependency managment * Rake-like cli tasks (mix) * Compile-time metaprogramming * Clean and consistent standard library * Really good UTF8 support * Well, syntax in a sense "easier to understand for switchers from ruby/python/etc"