

Erlang: The Written History - josette
http://www.josetteorama.com/erlang-the-written-history/

======
ams6110
Interesting to observe that on the subject of Erlang, a very mature and
powerful language, along with its incredible OTP framework, there are maybe
ten books published (Armstrong lists six; I'm seeing a few others on Amazon).

Compare that to the entire bookcases that have been written about Java, .NET,
Visual Basic, etc.

~~~
rdtsc
A see a couple of reasons, some positive and some negative:

* Erlang is not as popular.

* It is rather a niche language suited for some domains but it is not for others (compute oriented languages). So not many "How to write games in Erlang" or "Statistics in Erlang"

* Erlang documentation is pretty good. It is not pretty (look like it its style got stuck in late 90s), but it is comprehensive

* Erlang programmers I find are good self-starters and of higher quality than other programmers. It is just what I observed I maybe wrong. This is the same as Haskell or Rust perhaps. That means they learn and find out stuff on their own.

* Erlang is self-consistent. There are not that many ways to do one thing. Not like Scala, C++ or Java. That means there is usually a canonical good way. That also means less "Erlang patterns". Usually large number of "patterns in X" means there is some deficiency in the language or library. That means a small cottage industry of writing "patterns in X" books.

------
rdtsc
Ordered it!

Erlang is rather fascinating. It is a relatively old language and for being
such an old language it managed to keep consistency and didn't explode into an
all singing all dancing pony with 100 ways of doing everything. It syntax is
strange compared to run of the mill curly bracket languages, but it is self-
consistent.

It is also interested because it is adding rather fundamental features to it
like maps. Yes, yes, all the modern languages have them and Erlang is about to
them too! despite being a rather ancient language.

[http://erlang.org/pipermail/erlang-
questions/2013-May/073656...](http://erlang.org/pipermail/erlang-
questions/2013-May/073656.html)

~~~
derefr
> It is also interested because it is adding rather fundamental features to it
> like maps. Yes, yes, all the modern languages have them and Erlang is about
> to them too!

I don't know whether I'd say Erlang didn't have (hash-)maps before.

Each Erlang process has always had a "process dictionary." If you think of
these as equivalent to another language's thread-local variables, this seems
like a wrong comparison--and people tend to avoid using the process dictionary
for this reason.

But if you think of processes as Erlang's _objects_ , in the OOP sense[1],
then the an object's process dictionary is equivalent to that object's
"slots", in the Python/Javascript/Lua sense. And so, if you want a
(automatically concurrency-safe!) map, you just make a new "map server" object
that responds to get and set messages by manipulating its process dictionary.
Which is exactly how you'd expect a mutable hashmap object to work in any
other language.

Or, you can avoid this low-level stuff by using ETS tables instead, if the
difference between O(log N) and O(1) performance doesn't much matter to you...
but if you think about it, ETS tables are basically just doing this same
thing: creating a separate object/process that responds to messages to hold
your mutable state, rather than representing it as an on-stack data structure.

\---

[1] Alan Kay was probably describing something closer to Erlang (or Simula)
processes, than Java "objects", with OOP. Here's the unabridged quote:
[http://userpage.fu-
berlin.de/~ram/pub/pub_jf47ht81Ht/doc_kay...](http://userpage.fu-
berlin.de/~ram/pub/pub_jf47ht81Ht/doc_kay_oop_en) . Note especially this part:
"I thought of objects being like biological cells and/or individual computers
on a network." Both of those conceptions necessarily involve concurrent
computation on the part of each "object."

~~~
rdtsc
None of those offer "dynamic" records type feature. So you deserialize a json
block (and for better or for worse json is here to stay). What should the
output of that be? A new process with a process dictionary? A new ETS table? A
proplist of sorts. Well it could be all of those the best answer is a map.
Which is what we are about to get.

------
artellectual
I am actually reading through the book right now I have to say Joe did a great
job with the book. Explaining concepts I thought was difficult in a clear
manner. It's fun going through the examples as well. A real page turner for
me.

------
AlexanderDhoore
Just ordered it on amazon! Ready to be enlightened.

------
rodly
Can someone give me some real world examples of where Erlang really out does
Java/C#/C++/etc?

~~~
kenster07
It is built with concurrency in mind, from the ground up, making it much
easier to write concurrent programs than when using the traditional languages
that you've listed.

1) Every process in Erlang manages its own memory and has its own GC. This
means that GC'ing one process will not stop the world.

2) Erlang has multicore compatibility baked in, through its process-based
model.

3) Erlang enforces pure message-passing at a language level, so there is no
shared state. This allows concurrent programs to be written much more easily
than in languages where one has to manage shared state.

4) Referential transparency - to the programmer, one can use virtually the
same code to pass a message on a remote Erlang process and an Erlang process
on the same machine.

5) Fault-tolerant and self-healing mechanisms built in.

This is not an exhaustive list -- it just gives you an idea.

~~~
craigyk
> 1) Every process in Erlang manages its own memory and has its own GC. This
> means that GC'ing one process will not stop the world.

Most processes are so short lived, and with message passing, that the GC often
might not have to do anything. You just free all memory allocated by
processes.

> It is built with concurrency in mind

Like Go on crack. Processes are cheap and are used the same wether they exist
on the same machine or a different one. And it has pattern matching.

