Type safe Scala actors

前端 未结 3 1494
感情败类
感情败类 2021-02-05 20:18

Is there any way to specify what type of message an actor can accept and give a compile error if anything tries to send it some other type?

3条回答
  •  梦谈多话
    2021-02-05 20:58

    I think the answer is in the post referred to by @mkneissl : "The common practice is to declare what messages an Actor can recieve in the companion object of the Actor, which makes it very much easier to know what it can receive."

    An example of that would be useful...

提交回复
热议问题