Peter, the problem in David’s case is that the actions he wants to order
execution of are port data sending, and there is no “something lower level,
like Tasks” for that. The only API available for port data sending is Cmd
-based.
​

2016-10-15 23:06 GMT+02:00 Peter Damoc <pda...@gmail.com>:

> Cmd.batch does not make any guarantee about the order of execution. It is
> use to bundle a batch of commands in one entity.
>
> If you need order of execution, you need to use something lower level,
> like Tasks where you have `andThen`.
>
>
> On Thu, Oct 13, 2016 at 9:59 PM, David Andrews <random...@gmail.com>
> wrote:
>
>> When using Cmd.batch to send data over two ports, the ports receive the
>> events in the same order regardless of the order in which they appear in
>> the batch.  I would expect the events to occur in the order they appear in
>> the batch.
>>
>> Working example: https://daviddta.github.io/elm-port-order-bug/
>> Code: https://github.com/DavidDTA/elm-port-order-bug
>> Looking at the console, we see that port one always receives the event
>> before port two.
>>
>> As some motivation, consider two ports which both write to the same local
>> storage key.  Without a guarantee on the ordering of events, the two
>> subscriptions will race to write the key.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Elm Discuss" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to elm-discuss+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> --
> There is NO FATE, we are the creators.
> blog: http://damoc.ro/
>
> --
> You received this message because you are subscribed to the Google Groups
> "Elm Discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to elm-discuss+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to