Two kinds of actors?One of the biggest strengths of the Erlang VM is its approach to lightweight concurrency. if you !? them a message they aren't explicitly hardcoded to understand (and yes nitpickers, common behaviors can be abstracted into functions) they will ?! at your message and ignore it. Objects implicitly participate in the same actor protocol, because they all inherit the same behavior from their common ancestor. You can't observe anything without its cooperation/coordination - making ad-hoc reporting or analysis impossible, instead forcing every actor to participate in each protocol.Reia offers a solution to this problem with its objects-as-actors approach: all actor-objects speak a common protocol, the "Object" protocol, and above that, they speak whatever methods belong to their class. Coordinating activities involving multiple actors is very difficult. You can only handle messages you anticipated receiving. Programs are decomposed as piles of blocking switch statements. It reduces your flexibility in modeling - this is a world in which everyone sits in a windowless room and communicates only by mail. The result is a language which straddles two worlds: objects acted upon by function calls, and actors which are acted upon by messages.įurthermore, Scala's actors fall prey Clojure creator Rich Hickey's concerns about actor-based languages: Scala also implements the actor model, which is in turn inspired by Smalltalk and its messaging-based approach to object orientation. "sending a message to an object") are little more than function calls which act upon and mutate those states. In this model, objects are effectively just states, and method calls (a.k.a. Scala's object model borrows heavily from Java, which is in turn largely inspired by C++. In Scala, actors are objects, whereas in Reia objects are actors. Scala takes an "everything is an object" approach, with actors being an additional entity which duplicates some, but not all, of the functions of objects. Reia can use the standard method invocation syntax because in Reia, all objects are actors. To illustrate the point, let me show you some Scala code: WTF?! While it's easy to poke fun at an operator that resembles an interrobang, the duplicated semantics of this operator are what I dislike. Seeing RPCs as exceedingly common, the creators of Scala created an operator for it: " !?"
Time, that's why it's nice to be able to open up things and muck around at the RPCs are extremely prevalent in actor-based programming, to the point that Joe Armstrong, creator of Erlang, says:ĩ5% of the time standard synchronous RPCs will work - but not all the As the actor protocol is asynchronous, RPCs provide synchronous calls in the form of two asynchronous messages, a request and a response. The WTF OperatorOne of the most common patterns in actor-based programs is the Remote Procedure Call or RPC. There were some particularly egregious cases. I also began to realize that Scala was running into this problem as well. More and more I found myself trying to reinvent objects with actors. However, rather quickly I discovered something about using actors and objects in the same program: there was considerable overlap in what actors and objects do. MenTaLguY is perhaps the most concurrency-aware Ruby developer I have ever met, so I felt I may be on to something. Like Scala, Revactor was heavily influenced by Erlang, to the point that I had created an API almost virtually identical translation of Erlang's actor API to Ruby as MenTaLguY had in his actor library called Omnibus. Revactor let you write sequential code using normal Ruby objects, while using actors for concurrency. This is an idea I would carry over into Ruby with Revactor library, an actor model implementation I created for Ruby 1.9. I was initially excited about Scala but slowly grew discontented with it.Īt first I enjoyed being able to use objects within the sequential portions of my code and actors for the concurrent parts.
Aside from Erlang, it was one of the only languages besides Scheme and Io I had discovered which had attempted an actor model implementation, and Scala's actor support seemed heavily influenced by Erlang (even at the syntactic level). I was extremely interested in the actor model at the time, and Scala provides an actor model implementation. I originally tried Scala back in 2007, shortly after I started becoming proficient in Erlang. You may think given these similarities I would like Scala. My language Reia is also a hybrid functional/imperative object/actor language. Scala is a hybrid functional/imperative object/actor language for the Java Virtual Machine which has recently gained notoriety by Twitter selecting it as the basis of their future development.