plain_fsm - for beginners and purists

Vlad Dumitrescu vlad_dumitrescu@REDACTED
Fri Feb 13 10:57:31 CET 2004


From: "Ulf Wiger" <ulf.wiger@REDACTED>
> > receive
> >     .... %% nomal clauses
> >     Msg ->
> >         plain_fsm:handle(State, Msg)
> > end;
>
> Well, it forces the programmer to accept that messages not recognized by
> the preceding clauses (which are not system messages) are summarily
> discarded.

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.

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" ;-)

/Vlad




More information about the erlang-questions mailing list