Reputation: 6249
I'm following along in Programming in Scala edition 1 30.3 (p589). There it explains that you can use 'self' as an actor for the current thread to debug actors in the repl. However, when I follow along with Scala 2.9.1 the thread hangs on receive.
$ scala -unchecked -deprecation
Welcome to Scala version 2.9.1.final (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_26).
Type in expressions to have them evaluated.
Type :help for more information.
scala> import scala.actors.Actor._
import scala.actors.Actor._
scala> self ! "hi"
scala> self.receive { case a => a }
[hangs - should be "res1: Any = hi"]
I check with Scala 2.7.7 and it works as expected. How can I get this to work with Scala 2.9.1?
Upvotes: 0
Views: 186
Reputation: 3118
because 2.9.1 REPL each input run differentThread.
see https://gist.github.com/1324774
please use "-Yrepl-sync" option ,Than each input same Thread.
Upvotes: 5