-
Notifications
You must be signed in to change notification settings - Fork 1
Chains
laforge49 edited this page Sep 8, 2011
·
13 revisions
It can be awkward at time to execute a series of operations.
simpleActor(Prnt(1)) {
rsp1 => {
simpleActor(Prnt(2)) {
rsp2 => {
simpleActor(Prnt(3)) {
rsp3 => {
simpleActor(Prnt("scadoo!"))(rf)
}
}
}
}
}
}
Instead, we can simply create a list of operations and have them run by an actor.
val chain = new Chain
chain.add(simpleActor, Prnt(1))
chain.add(simpleActor, Prnt(2))
chain.add(simpleActor, Prnt(3))
chain.add(simpleActor, Prnt("scadoo!"))
Future(simpleActor, chain)