-
Notifications
You must be signed in to change notification settings - Fork 541
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deprecate automatic stashing #1474
Labels
Comments
This was referenced Mar 12, 2024
We have deprecated |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Currently, event-based actors automatically "stash" messages if users skip them in a default handler. Stashing basically means: a skipped message gets put into a stash until an incoming message matched the behavior. Then, all messages from the stash get put back into the mailbox and re-matched again for the next run.
There are some use cases where this work flow makes sense, but all actors have this stash, even if they never use it. It's also easy to shoot yourself in the foot with this implicit skipping, because the constant re-scanning can become expensive. Instead of doing this implicitly, we should instead:
caf::stash
class to allow actors that actually need this feature to use it manually.skippable_result
as well as the default handler in general (set_default_handler
) and remove with version 1.0. Event-based actors that receive unexpected inputs should terminate.[](message msg) { }
(or any cv-qualified version thereof) could be treated as catch-all.Maybe we can also use this opportunity to get rid of the other special handlers as well. Issue #1423 already suggests using an alternative approach for down messages. Basically just remove the old way instead of "overloading" it. We could get rid of the
exit
handler as well: just add a[](const exit_msg&)
handler to your behavior if you want to "override" the default behavior. In my experience, actors that override the exit handler very rarely switch behaviors. The original idea of separating the exit handlers from the behavior was to allow actors to have "constant" exit handler with changing behaviors, but several years later, I think that's just a non-issue. By going down this route, we could get rid of all of these member variables:I think it's also an easier mental model to have (and teach). There's the
behavior
of an actor that has your message callbacks. If an actors fails to match a message, it panicks (i.e., terminates). Period. Currently, it's: "Thebehavior
has your message callbacks, but then there are these 5 special cases where CAF treats messages differently."The text was updated successfully, but these errors were encountered: