Are there things Elixir can do that Erlang cannot, or vice versa?

后端 未结 4 1353
余生分开走
余生分开走 2020-12-22 17:59

This question is in the context of the Beam VM and the capabilities that it provides, not in the general context of what a Turing complete language can do. I want to invest

相关标签:
4条回答
  • 2020-12-22 18:21

    Just to preface - I have only used Elixir in production and not Erlang.

    I would honestly recommend Elixir. This is my opinion and not necessarily the right one for you, but below I will list my reasons why.

    1. Productivity: I come from a Ruby/Rails background so the Elixir syntax and style is something that was very familiar to me. One of the main factors that helps me determine whether or not to learn a language is how productive I can be in it - mainly why I chose Ruby. Elixir is the same. I can work just as fast in it as I can Ruby with all the added benefits of concurrency and pattern matching.
    2. Erlang: Since Elixir is built on top of Erlang and compiles down to erlang and the beam vm, you have access to every erlang module and package. So if you are worried about using elixir and missing out on all of the features of Erlang, you shouldn't be. Elixir even has it's own implementations of most of the bigger Erlang/OTP features such as GenServer, GenEvent etc.
    3. Community/Resources: The Elixir community is really a great one. The slack channel is really popular and great way to get some answers for beginner questions. There are already some really good books written on the language (Programming Elixir 1.2 - Dave Thomas, Author of the Ruby Pickaxe) also that make getting into the language really easy.

    Really, if you have a mess around with the two you will probably come to the same decision that Elixir is a much nicer language with all the features of Erlang + More. It's on the rise as well, I can't remember the exact numbers but I remember reading something from the Hex website (package manager) about a considerable increase in package downloads.

    0 讨论(0)
  • 2020-12-22 18:23

    You shouldn't stumble on anything you can do in one that you can't in the other, since you can freely call Elixir code from Erlang and vice-versa. You can even easily mix Erlang and Elixir files in one project.

    In Elixir:

    :erlang_module.erlang_function(args)
    

    in Erlang:

    'Elixir.ElixirModule':elixir_function(args)
    
    0 讨论(0)
  • 2020-12-22 18:32

    There are a few things. I think you can't make a recursive anon function in Elixir. Now to be fair this is something that in 8+ years of Erlang I don't think I have ever needed to do, and if I did it could be done easily in some other way. There are probably a few other things like that that quite honestly you can ignore.

    In general, for things that most people care about anything you can Do in Erlang, you can do in Elixir and vice versa. The community on the Elixir side seems to be more active so I would suggest starting there. I have recently moved from Erlang to Elixir and with the exception of a few fancy things in Proper I can say that it is a pretty easy transition

    0 讨论(0)
  • 2020-12-22 18:35

    TL;DR - Start with Elixir

    Erlang has a steeper learning curve compared to Elixir. Once you start learning Elixir, you will automagically start learning Erlang. Hence, start out with Elixir. Elixir is written in Erlang and Elixir. See distribution on Github (since Elixir is full of macros aka meta-programming).

    You can use Elixir with Erlang and vice-versa, hence the full Erlang eco-system of 20+ years of libraries.

    More details from Erlang Solutions

    Elixir’s ‘out of the box’ productivity is accomplished by a strong focus on tooling and convenience in expression of data manipulation. System design is the same in Elixir and Erlang, but Elixir removes a lot of boilerplate code and is easier to extend. The removal of boilerplate raises productivity and allows programmers to get feedback faster – crucial when you want to launch your product to market as fast as possible. Less boilerplate also makes for happy developers, and happy developers are unsuprisingly productive developers.

    Joe Armstrong's (Erlang inventor's) blog post about Elixir

    Start here to learn about Elixir - Getting Started

    Once you feel its going well, work your way towards practicing on Exercism and other resources.

    0 讨论(0)
提交回复
热议问题