I am completely new to Scala, and I have worked my way through Scala Programming (O'Reilly) online; however, I was surprised by the result of the shapes-actor-script.scala example in Chapter 1, “Taste of Concurrency” .
In particular, the output of scala -cp . shapes-actor-script.scala scala -cp . shapes-actor-script.scala should be:
Circle.draw: Circle(Point(0.0,0.0),1.0) Rectangle.draw: Rectangle(Point(0.0,0.0),2.0,5.0) Triangle.draw: Triangle(Point(0.0,0.0),Point(1.0,0.0),Point(0.0,1.0)) Error: Unknown message! 3.14159 exiting...
About 10% of the time, I get no output, and even less often, I will only get the first line as output. I don’t know enough about Scala, but I don’t know if this is normal due to the way the actor works, or something may be wrong with my installation of Scala (Scala 2.8.1 on Arch Linux).
Can Actors not process such messages (possibly due to the way the example is written)? Or is there something else I can skip here?
user561585
source share