3 ms·
> "erlang was kinda off doing its own thing, syntax-wise, and so some of it is just Like That now." The syntax makes a lot more sense if you go into the histor
by Jtsummers 3y ago
> "erlang was kinda off doing its own thing, syntax-wise, and so some of it is just Like That now."
The syntax makes a lot more sense if you go into the history (well-documented) and understand that Erlang's initial implementation was in Prolog and a lot of the syntax can be seen as a consequence of that.
As for pattern matching in the function signature instead of forcing dropping to a case expression, it removes a level of useless and noisy indentation and, again, is a lot more like Prolog.
Even the use of , and ; as separators in Erlang make sense given that heritage. In Prolog a sequence like this:
A, B, C.
Can be read as "A and B and C" while:
A; B; C.
Can be read as "A or B or C". So function bodies using , as a separator and ; between alternatives with . as a terminal follows straight from Prolog.