1. 5
  1.  

  2. 4

    This should make picking up Elixir as an Erlang developer very easy, and makes interoperability between Erlang and Elixir pretty simple.

    I’ve found this wholly untrue. Elixir has moved away from the semantics and style that Erlang imposes to the point where going from one to another is an exercise in frustration and pain. I, as somebody who knows Erlang, wouldn’t give it up for what Elixir offers.

    1. 2

      Thanks for pointing this out! I don’t have a lot of experience with Erlang, so I wrote that from an uninformed perspective. Would you mind pointing out some concrete examples of things that caused you frustration and pain?

      1. 2

        The easiest one to illustrate:


        Trying to call an Erlang function that takes a string.

        Erlang/OTP 18 [erts-7.3] [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]
        
        Eshell V7.3  (abort with ^G)
        1> os:cmd("uname").
        "Darwin\n"
        

        This breaks in elixir because their “strings” are binaries.

        Erlang/OTP 18 [erts-7.3] [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]
        
        Interactive Elixir (1.2.4) - press Ctrl+C to exit (type h() ENTER for help)
        iex(1)> :os.cmd("uname")
        ** (FunctionClauseError) no function clause matching in :os.validate/1
            (kernel) os.erl:384: :os.validate("uname")
            (kernel) os.erl:214: :os.cmd/1
        iex(1)>
        

        You can make Erlang express the same error by doing:

        2> os:cmd(<<"uname">>).
        ** exception error: no function clause matching os:validate(<<"uname">>) (os.erl, line 384)
             in function  os:cmd/1 (os.erl, line 214)
        

        And you can make it work by doing:

        iex(1)> :os.cmd('uname')
        'Darwin\n'
        

        1. 1

          Ah, problems with strings vs bistrings make a ton of sense. I can see why they wanted bitstrings to be the default in Elixir, though.

          1. 1

            Which is fine, but makes translating hard. Elixir basically asks you to either constantly remember this fact, or forget erlang entirely when working with it.

      2. 1

        Would you mind pointing to a few more examples (besides having to remember one fact about strings) to help me understand your experience of interop simplicity as being “wholly untrue” and “an exercise in frustration and pain”? (FWIW I’m a full-time Elixir dev learning Erlang more deeply, love both languages and have had zero problems with interop so far.)

      3. 2

        What is a “Programming HP and MP”?

        1. 3

          Assuming its “Health Points” and “Mana Points”. In fantasy role playing games, characters would consume elixirs to restore theses.

          1. 2

            consume elixirs to restore theses.

            Now I’m imagining a graduate-school based RPG where you suffer academic death if a dragon eats your thesis.

            1. 2

              Woops.

              Now I’m imagining a graduate-school based RPG where you suffer academic death if a dragon eats your thesis.

              Assuming that Persona or Disgaea would fold that in at some point.