[erlang-questions] Message Receive Semantics (was eep: MultiplePatterns)
Sun Jun 1 13:22:06 CEST 2008
> From: "Steve" <>
> ...can anyone clarify for me why you would wish to retain messages in
> the process mailbox that the process didn't wish to receive or act
Consider a following scenario: for every five "high" priority messages
processed, I wanted to handle three "normal" and one "low" priority
message(*). To implement this with a selective receive is relatively easy
and concise, even for a novice programmer. To do without it, may be
considerably more difficult and messy.
Aside selective receive caveats due to the current realization (I really
like Sean's idea for optimization), Erlang is much better with, than without
it. IMO, the selective receive reflect the spirit of ERLANG. After all, you
don't have to use it.
> Yes - I'm asking why the erlang messaging works the way it does.
So, I suppose the answer might be: because everything else works pretty
much the same way.
(*) Assuming that priority is given as a part of the message.
More information about the erlang-questions