Can Actors in Scala fail to process messages? (example in O'Reilly's Programming Scala)

后端 未结 4 602
无人共我
无人共我 2020-12-18 11:15

I\'m completely new to Scala, and I\'ve been working my way through Programming Scala (O\'Reilly) online; while doing so, I was surprised by the result of the

4条回答
  •  伪装坚强ぢ
    2020-12-18 11:39

    Sorry for the long delay in replying to this thread (since I wrote this example in the book :^/). I believe the real problem is that STDOUT isn't flushed by default on all OS (and shell?) environments and the behavior appears to differ depending on the version of Scala. This evening, I compiled and ran the code using 2.7.7. 2.8.0, and 2.8.1 on OS X (10.6.6), Java 1.6.0_24-b07-334-10M3326, and bash.

    For 2.7.7 and 2.8.1, all the output was printed before the process exited. For 2.8.0, only some output appeared! When I added "System.out.flush" to the end of the shapes-actor-script.scala, all output was printed for 2.8.0.

提交回复
热议问题