[erlang-questions] eep: multiple patterns

Ulf Wiger (TN/EAB) ulf.wiger@REDACTED
Thu May 29 23:21:29 CEST 2008


Dave Peticolas skrev:
> 
> Could you expand on this point for the benefit
 > of the newbies? :)
> I'm not clear about what exactly is the problem
 > with gen_server's message handling and what the
 > better approach is.

The problem is not with gen_server, which is wonderful
for implementing client-server patterns.

The issue is with FIFO message handling, at least when
used for complex state machines. It is very difficult
to write a behavior that lets the user have control
over selective message reception. In selective receive,
you can use only patterns and guards, and neither can
be extended with user-defined logic via a callback
function.

Here are some slides from EUC 2005 on the topic:
http://www.erlang.se/euc/05/1500Wiger.ppt


You could read the thread:
"plain_fsm - for beginners and purists"
from 2004:

http://www.erlang.org/pipermail/erlang-questions/2004-February/011403.html

and then the "higher-order receive anybody" thread:

http://www.erlang.org/pipermail/erlang-questions/2004-February/011514.html



This most likely give you more detail than you asked for. (:

BR,
Ulf W



More information about the erlang-questions mailing list