Scala pattern matching confusion with Option[Any]
问题 I have the following Scala code. import scala.actors.Actor object Alice extends Actor { this.start def act{ loop{ react { case "Hello" => sender ! "Hi" case i:Int => sender ! 0 } } } } object Test { def test = { (Alice !? (100, "Hello")) match { case i:Some[Int] => println ("Int received "+i) case s:Some[String] => println ("String received "+s) case _ => } (Alice !? (100, 1)) match { case i:Some[Int] => println ("Int received "+i) case s:Some[String] => println ("String received "+s) case _