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

Loïc Hoguin <>
Fri Feb 19 17:06:04 CET 2016


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?

-- 
Loïc Hoguin
http://ninenines.eu
Author of The Erlanger Playbook,
A book about software development using Erlang


More information about the erlang-questions mailing list