Created
May 31, 2020 14:09
-
-
Save yoshiyoshifujii/d03f6a13513f10afd1ba6b23f36efe25 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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