Fixed typed channels example.

git-svn-id: http://lampsvn.epfl.ch/svn-repos/scala/scala/trunk@12270 5e8d7ff9-d8ef-0310-90f0-a4852d11357a
This commit is contained in:
phaller 2007-07-11 14:39:34 +00:00
parent 3370a41597
commit b5f0c98e72
1 changed files with 9 additions and 3 deletions

View File

@ -12,15 +12,21 @@ object channels extends Application {
b ! Msg(Ch1, Ch2)
val ICh1 = Ch1.asInstanceOf[InputChannel[int]]
val ICh2 = Ch2.asInstanceOf[InputChannel[String]]
react {
case Ch1 ! x => Console.println("received on int channel: "+x)
case Ch2 ! y => Console.println("received on String channel: "+y)
case ICh1 ! (x: Int) =>
val r = x + 21
println("result: "+r)
case ICh2 ! y =>
println("received: "+y)
}
}
val b = actor {
react {
case Msg(ch1, ch2) => ch1 ! 42
case Msg(ch1, ch2) => ch1 ! 21
}
}
}