Advertisement
Guest User

Tped actor

a guest
May 29th, 2017
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scala 0.91 KB | None | 0 0
  1. Welcome to Scala.next (pre-alpha, git-hash: unknown)  (OpenJDK 64-Bit Server VM, Java 1.8.0_131).
  2. Type in expressions to have them evaluated.
  3. Type :help for more information.
  4. scala> trait ActorRef[T]
  5. defined trait ActorRef
  6. scala> case class Message(s: String, sender: ActorRef[Int])
  7. defined class Message
  8. scala> class Fut[T]()
  9. defined class Fut
  10. scala> trait Actor[T] { def ?[R](f: ActorRef[R] => T): Fut[R] = new Fut }
  11. defined trait Actor
  12. scala> object actor extends Actor[Message]
  13. defined module actor
  14. scala> val res: Fut[Int] = actor ? (Message("str", _))
  15. val res: Fut[Int] = Fut@625dfff3
  16. scala> actor ? (Message("str", _))
  17. -- [E007] Type Mismatch Error: <console>:11:24 ---------------------------------
  18. 11 |actor ? (Message("str", _))
  19.    |                        ^
  20.    |                        found:    ActorRef[Any](_$1)
  21.    |                        required: ActorRef[Int]
  22.    |
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement