On Fri, May 12, 2017 at 8:07 PM, Frank Bonetti <[email protected]>
wrote:

> > Imagine for a second that the first task takes 2 seconds the second task
> 1 second and the third 500ms. They finish in reverse order. If you want
> their result immediately after they finish, the results will come in the
> wrong order.
>
> Totally understand. Why do the commands *start* in reverse order though?
>

What you are seeing is an artifact of the current implementation.
In short it happens because of the way lists are implemented and because it
takes the first element from a list (car) and cons it to another list
The simplified version of what happens is exemplified by this ellie example:
https://ellie-app.com/39Qy5qycs8Qa1/0

Now, if you want to go further and ask another *why*, you will have to get
very intimate with the rest of the implementation details in order to
understand the trade-offs in various approaches and to understand why this
one has been chosen. (I can only guess that it was a performance reason)

If you have enough JS knowledge you can dig deeper into the Platform/Scheduler
code
<https://github.com/elm-lang/core/blob/master/src/Native/Platform.js#L311>.

Elm's JS kernel code is quite readable.



-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to