Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save yoshiyoshifujii/d03f6a13513f10afd1ba6b23f36efe25 to your computer and use it in GitHub Desktop.
Save yoshiyoshifujii/d03f6a13513f10afd1ba6b23f36efe25 to your computer and use it in GitHub Desktop.
// classic
class Ping() extends Actor {
def becomOpen(becameReceive: Receive): Unit = {
// 今のActorにメッセージを送ることができる
context.become(becameReceive)
// 変わった後のActorにメッセージを送ることができる
}
}
// typed
object Ping {
def becomeOpen(becameBehavior: Behavior[BecameCommand]): Behavior[BecameCommand] = {
// 今のActorにメッセージを送ることができる
becameBehavior // ここで変わった後のBehaviorを返却する必要があるので、事後処理的にこれ以上、処理を書くことができない
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment