Erlang and Actor Model – Is Erlang Truly an Actor Model Language?

actor-modelakkaerlang

I was reading this article:

http://www.doc.ic.ac.uk/~nd/surprise_97/journal/vol2/pjm2/

And it mentions that:

…in the actor model even an integer is represented as an actor…

Wikipedia confirms:

The Actor model adopts the philosophy that everything is an actor.

Erlang has many data types and those types are not actors as far as I can tell.

Doesn't it mean that Erlang is not an actor model language in a way some people say that e.g. Java is not a functional language just because it lacks certain functional programming features?

PS: by extension it means that Akka is definitely not an actor model because in addition to non-actor data types coming from the host language it even allows inheriting actors to extend their behavior via host language facilities.

Best Answer

Although the Actor Model is older than Erlang, the designers of Erlang only learned about the Actor Model after having designed Erlang, so some differences are to be expected.

They followed parallel paths of evolution, though: the Actor Model was created by Carl Hewitt based on the message passing semantics of Smalltalk. Alan Kay, in turn had based the message passing semantics of Smalltalk on the goal-driven evaluation of PLANNER, which was designed by … Carl Hewitt.

PLANNER was the precursor to Prolog. Erlang was originally not intended to be a language, rather it started out as a library for fault-tolerant distributed programming in Prolog, and later evolved into a dialect of Prolog, before it became its own language, still to this day heavily influenced by Prolog (plus, the original Erlang interpreter was written in Prolog).

So, the similarities between Processes in Erlang, Objects in OO, and Actors in the Actor Model are far from coincidental.

Erlang is a language with several layers, each of which are supersets of the lower layers. The smallest layer is Functional Erlang. This is a standard functional language with some additions inherited from Prolog, such as unification instead of binding/equality. If we add Processes and Messages to that, we get Concurrent Erlang. Throw in remote processes, and you get Distributed Erlang. Now add some libraries and design patterns from the OTP, and you have fault-tolerant Erlang.

Processes are Actors. (They are also Objects.) The inside of Processes is Functional, not Actor-based. The structure of a large fault-tolerant Erlang system constructed using the tools and patterns of the OTP, is often very Object-Oriented.

So, it depends on what scale you are looking at.

In a typical large Erlang system, you have an object-oriented architecture with message-passing actors implemented using functional programming. What OTP calls a server is closely related to an object, servers are made up of processes (which are actors), processes use functions internally.

In general, I don't believe that any pure Actor Language has ever left research. Heck, I don't even know if Carl Hewitt's PLASMA, the original Actor Language was ever even implemented.

Related Topic