[erlang-questions] examples for erlang with joins

Richard O'Keefe ok@REDACTED
Tue Mar 10 00:40:31 CET 2009

On 10 Mar 2009, at 2:08 am, Hubert Plociniczak wrote:

> Message {test, test1, test2} is first in the message. foo is second.
> Similarly as in original receive I take the newest message and check  
> if only with this message I can satisfy any of the joins.
> If that is not possible, then I go the next message and check if any  
> of the joins can be satisfied using the new message (and all  
> previous ones).
> Since {test, test1, test2} already satisfies one of the joins, then  
> I fire it immediately and do not look at what else is in the message
> after {test, test1, test2} (though I might obviously look at it in  
> the future, if I have any receive constructs afterwards).
> I hope that helps.

Actually, it helps to scare me off.
It reminds me too much of XSLT.
For one thing, the current receive construct (conceptually)
always starts its search with the *OLDEST* message, not the
newest one.

So we have in the mailbox
    oldest = {test,test1,test2}
    newest = foo
and in the matching process, the first thing we hit is
    _X and foo
and _X does match the first message that we should look
at (namely the oldest) and foo does then match the
remaining message.

More information about the erlang-questions mailing list