by haspok · 3y ago · 0 comments
Erlang (the language) is rooted in Prolog, and many of its best traits can be traced back to this fact. That everything is a pattern, and you can pattern match pretty much anything is rarely found in other languages, for example. Elixir made a mistake in my opinion when it went with a Ruby-like syntax.
Also, there are those kinds of problems where in Prolog you can express and solve them in a few lines, in other languages you struggle a lot (and at the end you just reimplement half of the backtracing engine anyway - see Greenspun's tenth rule). Why it is not more commonly used in banking / finance is one of the greatest mysteries of life.
We had along the way also looked at concurrent logic languages. So by the time we had a language and design rules how to use it most of Prolog had disappeared, though some of its syntax still remained. This language was, of course, Erlang.
While Prolog was a nice base on which to develop our ideas it was never the language we would have used in real life.
Thank you for all the time you’ve taken to explain the “why” of Erlang!
(For those unfamiliar, go check out “The Erlang Rationale” and some of rvirding’s posts elsewhere, e.g., on the thread at https://elixirforum.com/t/the-erlang-rationale-by-robert-vir...)
https://dl.acm.org/doi/abs/10.1145/1238844.1238850 -- canonical link and has a video of the related talk (streamable and downloadable).
(Sadly, without ACM membership, the paper itself is paywalled; there are copies of it online though, e.g. https://www.labouseur.com/courses/erlang/history-of-erlang-a... ).
Block parameters, implicit parentheses for certain method/function calls, uppercase significance, symbolic significance for brackets.
What do you mean by "symbolic significance for brackets?"
I spent many years in perl, so I’m of the opinion visual indicators for datatypes are actually a good thing at the point of instantiation/composition.
Not sure how to properly word it
Comparing the two, I think Prolog may be easier for handling databases (I like Ecto, but it can be a little complex to set up and get right). Both Elixir and Prolog handle pattern-matching, but I think Elixir's syntax is nicer to work with. Of course, this is subjective. Both are great at handling list data. IO is consistently easy with Elixir whereas it can be difficult at times with Prolog.
Elixir and Erlang allow you to create supervision trees which can watch code and automatically and quickly recover from unexpected errors. Prolog's error handling and recovery can be slow. The overheard of calling a goal through catch/3, for instance, is quite significant compared to Elixir/Erlang.
I preferred the alpha syntax, which was ML-inspired, but it’s decent in its current incarnation.
I’ve always though the beam was really nice for building programming languages, and clearly that is true, as there are now more than a dozen targeting it.
Are you aware of other beam-targeting languages?
https://github.com/llaisdy/beam_languages
See you down the rabbit hole!
https://github.com/purerl/purerl & https://purerl-cookbook.readthedocs.io/ for more information. Join the PureScript discord and the #purerl channel if you want help.