1. 34
  1.  

  2. 14

    I don’t really understand why this “Elixir is like Ruby” idea took off in the first place. It’s got some small syntactic similarities, but also a lot of syntactic differences, and of course the semantics are totally different as well.

    When I started learning Elixir, my Ruby knowledge didn’t help me at all.

    1. 35

      Because Jose Valim created Elixir specifically to address his frustrations with Ruby. He worked on Delve for his employer (along with other devs), which one of the most popular gems in Ruby.

      Elixir and Phoenix (created by Chris McChord), are very much responses to Ruby and Rails respectively, even if the semantics aren’t similar under the hood.

      They aren’t similar semantically, but they are linked culturally at a deep level

      1. 4

        Interesting, I did not know that one of the motivating factors for creating Elixir was frustration with Ruby. Although, to be fair, in aspects other than syntactical similarities, I have never seen these two compared (one can hardly compare relatively simple scripting language with something based on the powerful BEAM engine).

        1. 6

          I would hardly call Ruby relatively simple, it’s got a lot going on, and has a decent amount of complexity, at least 3 implementations (jruby, Truffle Ruby and CRuby), a rather involved language with a lot of flexibility, and a rich history of things from Perl and such.

          Lua, I would consider relatively simple, because a Lua implementation is possible with one or two devs, where Ruby and Python are both much more involved as far as language details.

          It is true that Ruby has not had the most sophisticated run-time in the past, but it definitely isn’t simple.

        2. 2

          Thank you for explaining. Never knew they were so closely interlinked.

          He worked on Delve for his employer

          What’s Delve? I tried searching for it but couldn’t find anything, unless you mean this ruby gem for building roguelikes.

          1. 10

            I think that’s a typo, the gem he worked on was Devise: https://github.com/heartcombo/devise

            1. 1

              Thanks for catching that, you’re correct.

      2. 10

        I learned Erlang before Elixir, and it definitely helped me with Elixir tooling and the environment, which goes a long way learning a new language. But, honestly, I didn’t realize how much Erlang’s unique syntax helped me with Erlang. I think since it was so different than other languages, it was easy to start “thinking” in terms of recursion, pattern matching, and concurrency. When I started with Elixir, I had to remind myself that it isn’t Lua or C or Perl, it’s Elang with more normalized syntax. I am writing a lot more Elixir these days because I am using Phoenix, but I would prefer to write Erlang. Not that syntax is everything, but I enjoyed writing in it.

        1. 9

          But, honestly, I didn’t realize how much Erlang’s unique syntax helped me with Erlang

          Erlang doesn’t have unique syntax, it has Prolog-like syntax. Erlang was originally prototyped in Prolog and the syntax was never changed. Fortunately, although the semantics are very different, the style of programming is quite similar between the two.

          1. 4

            Ah, yes. I now remember reading that the syntax is Prolog inspired. Good reminder. I’ve never done anything in Prolog though so the syntax felt unique!

          2. 2

            When using it at work I did find Elixir’s syntax a bit clunkier for functional programming, if I’m honest. Prolog syntax has it’s quirks and is clunky in its own way, but it did seem like a better fit!

            1. 5

              Erlang code is beautifully terse. Very simple language, with minimal ornamentation.

              Elixir shines in other areas. I’m glad for the cross-pollination.

              1. 1

                Yeah, it was also good to see more people learning about pattern matching, immutability, and the actor model via Elixir. And those people bring other ideas too! So yeah, definitely glad for that.

          3. 4

            As an Erlanger, and ex-rubyist, I recall when I first heard of Elixir: I had a glance at the equivalent of the Rails’ `routes.rb,’ but in this new Phoenix/Elixir project that was gaining popularity. It was clear to me that one of the main goals of Elixir had to be to emulate the ruby syntax/patterns as much as possible from looking at that file (can’t recall what its namespace is in Phoenix). To my eyes, the sameness was uncanny. So despite the constant backpedaling from Elixir people that they’re only like Erlang, it’s clear to me that Elixir was designed to look like Ruby as much as possible.

            1. 3

              So despite the constant backpedaling from Elixir people that they’re only like Erlang, it’s clear to me that Elixir was designed to look like Ruby as much as possible.

              Well, not really. Elixir is for sure Ruby-inspired, but for sure it is nit designed to be “as much Ruby as possible”. It is designed to have bells and whistles that makes language as flexible as possible though - hence macros that allows for stuff that can be seen in Phoenix. Macros are great, even if overused sometimes.

            2. 1

              When it started out, it was always mentioned to me as “Erlang for Ruby people”.