Page 76 (PDF page 76):
Listing 6.2 will give Wrong forward reference,
Can not be evaluated at Scala console either.
Slave can be defined as an inner object of Master as:
import scala.actors.Actor
import scala.actors.Actor._
object Master extends Actor {
def act() {
Slave ! 'doWork
react {
case 'done =>
throw new Exception("Master crashed")
}
}
object Slave extends Actor {
def act() {
link(Master)
loop {
react {
case 'doWork =>
println("Done")
reply('done)
}
}
}
}
}
scala> Master.Slave.start()
res0: scala.actors.Actor = Master$Slave$@267fbe19
scala> Master.Slave.getState
res1: scala.actors.Actor.State.Value = Suspended
scala> Master.start()
res2: scala.actors.Actor = Master$@22006edb
scala> Done
Master.getState
res3: scala.actors.Actor.State.Value = Terminated
scala> Master.Slave.getState
res4: scala.actors.Actor.State.Value = Terminated
|
Page 88 (PDF page 88):
Listing 7.2:
joeActor should be started before sending a message to it
Ex:
ActorWithThreadLocalWrong.joeActor.start()
println("Your name: " + (ActorWithThreadLocalWrong.joeActor !?
'YourName))
println("Your name: " + (ActorWithThreadLocalWrong.joeActor !? 'YourName))
|
Page 72 (PDF page 89):
End of first paragraph says "After that, the actor terminates normally"
which is probalbly wrong, considering that page 148 (also end of first
paragraph there) says "execution continues with the current continuation
closure".
|
Page 81 (PDF page 98):
Program output should not be colorized in eBook, e.g. output of listing
6.5, starting "I'm (re-)born".
|