The document discusses the Ponylang programming language. It covers three main topics: 1) Concurrency in Ponylang uses the actor model or shared memory with synchronization to avoid data races and deadlocks. 2) Ponylang uses capabilities to safely share isolated or immutable state between actors. 3) The Ponylang runtime provides fast actors through techniques like message passing and a read/write barrier garbage collector.
19. class Counter extends Actor {
val set = mutable.Set[Int]()
def receive = { case data: Int =>
set.add(data)
resetter ! set
}
}
class Resetter extends Actor {
def receive = { case set: mutable.Set[_] =>
if(set.size > 10) set.clear()
}
}
mutable
※ code Pony
※ scala var + immutable copy
https://doc.akka.io/docs/akka/2.5.6/scala/general/jmm.html#actors-and-shared-mutable-state
race-condition