Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Welcome to Scala.next (pre-alpha, git-hash: unknown) (OpenJDK 64-Bit Server VM, Java 1.8.0_131).
- Type in expressions to have them evaluated.
- Type :help for more information.
- scala> trait ActorRef[T]
- defined trait ActorRef
- scala> case class Message(s: String, sender: ActorRef[Int])
- defined class Message
- scala> class Fut[T]()
- defined class Fut
- scala> trait Actor[T] { def ?[R](f: ActorRef[R] => T): Fut[R] = new Fut }
- defined trait Actor
- scala> object actor extends Actor[Message]
- defined module actor
- scala> val res: Fut[Int] = actor ? (Message("str", _))
- val res: Fut[Int] = Fut@625dfff3
- scala> actor ? (Message("str", _))
- -- [E007] Type Mismatch Error: <console>:11:24 ---------------------------------
- 11 |actor ? (Message("str", _))
- | ^
- | found: ActorRef[Any](_$1)
- | required: ActorRef[Int]
- |
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement