Erlang and the future of programming

September 1, 2007 ⋅ programming ⋅ 2 Comments »

I recently ran across a post by Brendan Eich (he of Javascript fame) entitled Threads Suck, in which he talks about support for concurrency in future versions of Javascript.

Speaking as someone who has a few years’ experience with serious multithreaded code — I’m talking dozens of threads manipulating several gigs of shared data — I agree with his assessment. Multithreaded programming is hard. It’s the quantum mechanics of programming. The simple act of observing your program will cause its behaviour to change inexplicably (see Heisenbug, Schroedinbug).

This is more relevant now than ever because it appears that Moore’s Law is coming to and end, and that the future is multiple processors with multiple cores. In other words, if you want your application to run faster, you gotta go concurrent.

So, that puts us in a bit of a pickle. The future is in concurrent programming, but we’re really bad it. So either all the programmers in the world need to get a lot smarter, or we need to find a better way to do write concurrent programs. It turns out there is a better way to write concurrent programs…which leads us to Erlang.

Erlang is a functional programming language invented at Ericsson and released as open source in 1998. Instead of multiple threads manipulating shared state, Erlang supports message-passing concurrency. Why is this good? Joe Armstrong explains in What’s all this fuss about Erlang?

In message passing concurrency, we say that there is no shared state. All computations are done in processes and the ONLY way to exchange data is through asynchronous message passing.

Erlang Has No Mutable Data Structures (Not quite true, but true enough).

No Mutable Data Structures = No Locks

No Mutable Data Structures = Easy to parallelize

Erlang has been getting a lot of buzz recently. Some people are even calling it the next Java. As much as I’m intrigued by Erlang, I have to say I’m really skeptical that a functional programming language will become “the next Java”. But Java was Smalltalk gussied up in C++ clothing…what will an “Erlang for the masses” look like?

But even if Erlang itself doesn’t become hugely popular, many of its features may eventually find their way into more mainstream languages. Stackless Python and Candygram are two examples in the Python world. Either way, it seems like we’re in for a major change in the way we write our code.


  1. Ray - September 3, 2007:

    "what will an “Erlang for the masses” look like?"

    It will look like Scala. (

    It has most of the features of Erlang, but with a Java like syntax.

  2. Patrick - September 4, 2007:

    Thanks for the pointer Ray. Never heard of Scala, but I'll check it out.