But Erlang itself? It's too weird, and in my brief experiments, the implementation shows its age; we have in fact learned some things about software since way back then.
--Tim Bray, Prognostication
I'm just quite new to Erlang and read through Chapter 10 of Programming Erlang so far. The language really expand my mind greatly, with its pattern-matching capability (even for a Haskell user), and of course concurrency oriented programming. Inter-process communication, even across different machines, is a quite simple task in Erlang. However, as stated by Tim Bray, Erlang is too weird. In the following, I will list some weird things I met when studying Erlang. The focus is mainly on syntax, which seems to be non-essential but should have been easily improved (if backward compatibility is not an issue).
Usage of punctuation
A newcomer to Erlang will almost forget to type period after an expression one or more times. Why do we need such punctuation even in an interactive shell? I admit that using period, semicolon and comma in Emacs makes source editing more automatic, but I prefer not using them at all. Erlang should learn something from the elegance of Haskell in this aspect.
Awkward functional programming with fun
There is no fun when using fun. When writing an anonymous
function, one have to use
fun and append
end. Even when calling a named function within a higher
order function, one has to use
fun like this
lists:map(fun math:sqrt/1, [1.0, 2.0, 3.0]). This is
awkward and Haskell way is way better again.
Although records are tuples in disguise, they are treated in a C-style way: i.e. if one record definition is to be used by multiple source files, it has to be put into an include file. Weird.
Fans of C/C++ may applaud when they learn that Erlang provided similar macro facilities. However it is doubtful whether this controversial feature is needed for such a functional programming language.
Again advocates of C/C++ might be pleased to know that Erlang also relies on makefile for package management/build. Shed by the light of Haskell/Cabal, Common Lisp/ASDF or X/Y (put your favorite language and package management system here), one may expect that Erlang has a more modern way?
Apparently, above weird aspects are not show-stopper for the popularity of Erlang. However, appreciating the Ruby principle of Least Surprise, I cannot help but rant my impressions gathered when climbing the mind-blown-away learning curve.