- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
Good Actor Style
Thu, 2011-03-31, 17:54
Hi all,
I'm putting together some actor functionality and had a question
about
'good style'. In reading "Programming In Scala" it mentions non-
blocking actors as being essential in having 'good actor style'. The
book recommends using helper actors to prevent non-blocking. From my
understanding of this and perhaps I'm dead wrong I came up with the
following pseudo implementation:
object MyActor extends Actor{
def someMethod = {
actor{
//implementation here
}
}
loop{
react{
case _ => someMethod
}
}
}
Now, again from my understanding the actor won't block, but haven't I
circumvented the non-threaded style inherent with using react by
creating an actor thread anyway when I call someMethod?
Thanks for advice on this.
nathan