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.
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?
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)
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.
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.)
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.
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?
The easiest one to illustrate:
Trying to call an Erlang function that takes a string.
This breaks in elixir because their “strings” are binaries.
You can make Erlang express the same error by doing:
And you can make it work by doing:
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.
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.
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.)
What is a “Programming HP and MP”?
Assuming its “Health Points” and “Mana Points”. In fantasy role playing games, characters would 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.
Woops.
Assuming that Persona or Disgaea would fold that in at some point.