From the class Principles of Reactive Programming on Coursera:
"If an actor sends multiple messages to the same destination, they will not arrive out of order (this is Akka-specific)."
actors A and B
A sends B msg1 A sends B msg2
B will receive msg1 and then msg2
Warning: I've never programmed in Erlang
I believe that this message ordering semantic isn't guaranteed in Erlang. This seems like a HUGE difference that effects the different types of programs you could write using what are supposed to be similar frameworks.
For example in Akka you could do:
case class msg(x: Int)
case object report
class B extends Actor {
var i: Int = 0
def recieve = {
case msg(x) => i = i + x
case report => sender ! i
}
}
then you could do
A send B msg(5)
A send B msg(6)
A send B report // guarantees that the sum will be 11
My main point is in that Erlang it seems that you couldn't guarantee that the sum returned would be 11. Does Erlang discourage or even forbid Actors from containing any mutable state? Can anyone elaborate on the different type of programs that can and cannot be written with Actors in Scala's Akka vs. Erlang?