Lightweight processes in Scala
Nick Linker
xlcr@REDACTED
Mon Jul 17 09:59:51 CEST 2006
Hi all,
Martin Odersky and Philipp Haller did some effort and implemented
Erlang-like lightweight processes over JVM using Scala language. Their
lightweight "actors" look like this:
class Counter extends Actor {
override def run(): unit = loop(0)
def loop(value: int): unit = {
Console.println("Value: " + value)
receive {
case Incr() => loop(value + 1)
case Value(a) => a ! value; loop(value)
case Lock(a) => a ! value
receive { case UnLock(v) => loop(v) }
case _ => loop(value)
}
}
}
The article can be found at
http://lampwww.epfl.ch/~odersky/papers/jmlc06.html.
Scala language homepage is http://scala.epfl.ch/.
Maybe I have overactive imagination, but I'm afraid, it could be serious
threat for Erlang from Java side because one of the most significant
advantages of Erlang over JVM were lightweight processes and now JVM
will have them.
With best regards,
Nick.
More information about the erlang-questions
mailing list