[erlang-questions] Proposal for new state machine engine: gen_statem

Raimo Niskanen <>
Fri Feb 19 17:12:07 CET 2016


On Fri, Feb 19, 2016 at 05:06:04PM +0100, Loïc Hoguin wrote:
> On 02/19/2016 04:43 PM, Raimo Niskanen wrote:
> > * If there are multiple transaction_option() in a state function return
> >    Ops, which one shall win, the first or the last? Currently the last wins to
> >    harmonize with that all Ops are executed in list order so the last one
> >    overrides the previous. This way you can not override a value by consing it
> >    to the head of Ops - you will have to append it instead, which is a bit
> >    uncommon.
> 
> I believe that when being provided with a list of commands, the commands 
> should be run in order and therefore the last one should always win. 
> That a command overrides a previous command is perfectly reasonable.
> 
> I don't think the list of commands will ever get very big, so Ops ++ 
> [override] shouldn't be an issue. Sure ++ is uncommon, but overriding is 
> also uncommon, isn't it?

Valid points.  Unfortunately this clashes with the behaviour of e.g
proplists.  Fred Hebert just pointed this out in the pull request.

By the way I think we should keep the discussion in the pull request
since the bulk is already there...

    https://github.com/erlang/otp/pull/960

> Loïc Hoguin
> http://ninenines.eu
> Author of The Erlanger Playbook,
> A book about software development using Erlang
> _______________________________________________
> erlang-questions mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-questions

-- 

/ Raimo Niskanen, Erlang/OTP, Ericsson AB


More information about the erlang-questions mailing list