groovy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jesper Steen Møller <jes...@selskabet.org>
Subject Re: About actor syntax for Groovy 3
Date Sat, 07 Jan 2017 17:30:33 GMT
But

Wouldn’t << be a natural choice which would work today?

-Jesper

> On 7 Jan 2017, at 18.16, Daniel Sun <realbluesun@hotmail.com> wrote:
> 
> 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.


Mime
View raw message