Hi all,
As we all know, GPars is awesome in concurrency programming. How about
introducing a new syntax for GPars's
actor(http://www.gpars.org/guide/guide/actors.html) to support concurrency
programming better like Erlang and
Scala(https://rocketeer.be/articles/concurrency-in-erlang-scala/)? We can
use <- to indicate sending messages(Erlang and Scala uses !). The initial
idea is shown as follows:
// groovy.actor.Actor extends groovyx.gpars.actor.DefaultActor
class Counter extends groovy.actor.Actor {
int counter = 0;
void act() {
react { int num ->
...
}
}
}
class ActorTest {
def counter = new Counter()
counter.start()
for (i in 0 .. 100000) {
counter <- i // send message to the counter actor
}
}
Any thoughts?
Cheers,
Daniel.Sun
--
View this message in context:
http://groovy.329449.n5.nabble.com/About-actor-syntax-for-Groovy-3-tp5737574.html
Sent from the Groovy Dev mailing list archive at Nabble.com.