Handle_call and Actor Model

Is handle_call part of the Actor Model? Since it sequentialize/synchronize things, is sound a bit like CSP (to me).

1 Like

In my opinion handle_cast/2 is more in line with the actor model and handle_call/3 is a concession to practicality as it is often necessary to await a result or simply have a request acknowledged. You may find these topic of interest:

To me GenStage seems more reminiscent of Communicating Sequential Processes - though not quite as constraining.

Plataformatec Blog: Small Data with Elixir

3 Likes

GenServer.call is just a practical wrapper around two asynchronous messages, it’s little more than:

send(server, {self(), msg})
receive do
  reply -> reply
end

handle_call is very much like handle_cast - it’s just that you don’t need to manually send the response at the end.

7 Likes

Who told you that OTP where following the actor model? @joeerl loves to deny, because Erlang and OTP are much older than the actor model…

4 Likes

For example:
Robert Virding: [erlang-questions] Erlang is not a implementation of the Actor model Re: Go vs Erlang for distribution

We had never heard of the actor model, at least I hadn’t. We had other
inputs, amongst others Eripascal which an internal Ericsson version of
Pascal which had processes and messages.

Hewitt got a lot of things wrong in his description of Erlang.

5 Likes

Not really. Actor model was first written about in 1973 (Carl Hewitt; Peter Bishop & Richard Steiger (1973). “A Universal Modular Actor Formalism for Artificial Intelligence”. IJCAI) but the Erlang team (1988) was not aware of it, so it was an independent discovery.

5 Likes

Oh, then I got those tweets wrong.

1 Like

The actor model is from 1974, Erlang from 1986.

I can’t remember if we knew about the actor model in 1985 I might have heard of it without knowing what it was. Erlang was directly influenced by smalltalk and prolog.

The idea of messaging comes from smalltalk and CSP. There are sufficient similarities between Hewitt’s actors and Erlang so I guess you can call Erlang an actor language - but Erlang has many things not in actors (like links etc.)

10 Likes