You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What happens to non-matching messages that might be sent to event-loop?
If message doesn't match, receive! will throw IllegalArgumentException. Once again as clojure/core.match does.
Should one do something to handle non-matching messages?
It depends on what desired behavior is:
The default way is to simply skip handling of unexpected messages and crash. Unexpected messages are usually sing of bugs. This way works if everything is linked properly.
Sometimes one expects arbitrary messages and wants to tolerate them. In such cases "catch all" clause at the end is the way to go.
It's not a final decision, but I really want to add "selective receive" working the same way as erlang's receive does. Using selective receive instead of receive! one can wait for a specific message leaving other messages untouched.
Consider a process function like:
A couple of questions:
[server ref :cancel]
only match messages from the specific value ofserver
passed to event-loop, any value of ref and:cancel
?The text was updated successfully, but these errors were encountered: