The syntax of Case in scala has several forms that it can take.
Some examples:
case personToGreet: WhoToGreet => println(personToGreet.who)
case WhoToGreet(who) => println(who)
case WhoToGreet => println("Got to greet someone, not sure who")
case "Bob" => println("Got bob")
case _ => println("Missed all the other cases, catchall hit")
, , , , case .
Case PartialFunction , , , , , .
- :
def something: PartialFunction[Any,Unit] = {
case "val1" => println('value 1")
case _ => println("other")
}
.

Akka , , : akka.actor.Actor. typedef Akka:
object Actor {
type Receive = PartialFunction[Any, Unit]
..
}
trait Actor {
def receive: Actor.Receive
....
}
def receive: PartialFunction[Any, Unit] = {
}
, Receive .