plain_fsm - for beginners and purists

Ulf Wiger <>
Fri Feb 13 11:19:53 CET 2004


On Fri, 13 Feb 2004 10:57:31 +0100, Vlad Dumitrescu 
<> wrote:

> Okay, what about
>
> receive
>     .... %% nomal clauses
>     Msg ->
>         plain_fsm:handle(State, Msg, 
> Fun_that_handles_non_system_messages)
> end;
>
> It's a little ugly, but maybe not too much.

Unfortunately this violates the selective receive semantics.
You cannot do this without consuming the message, and you can't
put it back where it was. Thus, you reorder the messages in the queue,
and this can cause subtle bugs. If you don't recognize the message,
you need to either throw it away or avoid touching it in the first
place.


> Introducing parse_transforms (and maybe lexer_transforms) on a more 
> regular basis is a cool idea, and interesting stuff might come out of it
> - but it's no longer matching the title of the topic "for beginners and
> purists" ;-)

Mnemosyne already does it. So does the fun2ms module in stdlib.

/Uffe
-- 
Ulf Wiger, Senior System Architect
EAB/UPD/S

This communication is confidential and intended solely for the addressee(s). Any unauthorized review, use, disclosure or distribution is prohibited. If you believe this message has been sent to you in error, please notify the sender by replying to this transmission and delete the message without disclosing it. Thank you.

E-mail including attachments is susceptible to data corruption, interruption, unauthorized amendment, tampering and viruses, and we only send and receive e-mails on the basis that we are not liable for any such corruption, interception, amendment, tampering or viruses or any consequences thereof.




More information about the erlang-questions mailing list