Find a way how an Actor can signal an unhandled message with minimum ceremony.
It is quite common for an actor to ignore messages it is not able to handle at a given moment. This should be handled with minimum ceremony within the receive method. On the other hand if a message has not been handled by an actor, its cell should report it to the dead letters mailbox.
This poses a requirement on the actor's receive method to signal whether a message has been handled or not. The question is how to do it properly.
Akka makes use of Scala's partial functions and the built in syntactic sugar for them to solve this elegantly (the cell can inspect whether the receive method is defined at a certain value).
In Swift we have to be more explicit. Possible solutions:
- The cell will assume that a message is unhandled unless the
receive method explicitly consumes it.
- The cell will assume that the message is handled unless the
recieve methods raises a specific error to signal otherwise
- The cell doesn't assume anythign. The
receive method returns Handled|Unhandled to signal the outcome.
Think about other possibilities (return the message if unhandled, etc...)
Find a way how an Actor can signal an unhandled message with minimum ceremony.
It is quite common for an actor to ignore messages it is not able to handle at a given moment. This should be handled with minimum ceremony within the
receivemethod. On the other hand if a message has not been handled by an actor, its cell should report it to the dead letters mailbox.This poses a requirement on the actor's
receivemethod to signal whether a message has been handled or not. The question is how to do it properly.Akka makes use of Scala's partial functions and the built in syntactic sugar for them to solve this elegantly (the cell can inspect whether the
receivemethod is defined at a certain value).In Swift we have to be more explicit. Possible solutions:
receivemethod explicitlyconsumes it.recievemethods raises a specific error to signal otherwisereceivemethod returns Handled|Unhandled to signal the outcome.Think about other possibilities (return the message if unhandled, etc...)