« Return to Thread: [scala] Why are Scala's actors untyped?

Re: [scala] Re: Why are Scala's actors untyped?

by Martin Odersky :: Rate this Message:

Reply to Author | View in Thread

Note that Actor inherits from OutputChannel, which is typed. So you can write:

scala> val x: OutputChannel[Int] = actor { ... }
x: scala.actors.OutputChannel[Int] = scala.actors.Actor$$anon$1@114382d

scala> x ! 2

scala> x ! "abc"
<console>:10: error: type mismatch;
 found   : java.lang.String("abc")
 required: Int
       x ! "abc"
           ^

Cheers

 -- Martin

 « Return to Thread: [scala] Why are Scala's actors untyped?