Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upBug in Task implementation ? #409
Comments
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
evancz
Sep 16, 2015
Member
We talked about this offline, but here's the result so we can close this. Case 2 is true. This API is not intended for public consumption so I "do the right thing" when I use the relevant functions. It is conceivable that these things will change if we add some message passing concurrency or open things up more.
|
We talked about this offline, but here's the result so we can close this. Case 2 is true. This API is not intended for public consumption so I "do the right thing" when I use the relevant functions. It is conceivable that these things will change if we add some message passing concurrency or open things up more. |
Gozala commentedSep 16, 2015
I have being trying to figure out how Tasks in Elm actually work and either I'm misunderstanding something crucial or I found a bug in the implementation. Relevant lines of code are following:
https://github.com/elm-lang/core/blob/6b505d4f5219b6e45967cc87cf99729bc3f12f03/src/Native/Task.js#L140-L160
So if Async task turns out to actually be sync then step of the running
roottask steps out into adonestate which I believe is incorrect as it assumes thatresultpassed into a callback is eithersuccessorfailuretask:https://github.com/elm-lang/core/blob/6b505d4f5219b6e45967cc87cf99729bc3f12f03/src/Native/Task.js#L146
On the other hand if task turns out to be async then root is resumed with a
resultpassed into a callback:https://github.com/elm-lang/core/blob/6b505d4f5219b6e45967cc87cf99729bc3f12f03/src/Native/Task.js#L147-L148
https://github.com/elm-lang/core/blob/6b505d4f5219b6e45967cc87cf99729bc3f12f03/src/Native/Task.js#L155
There for if passed
resultis neithersucceedorfailtask routine will be resumed and will continue by running aresulttask.From above I conclude that one of following is true:
success(v)orfailure(v)but that is not verified or enforced in any way. In this case it maybe worth changing anTask.asyncFunctioninterface so that user is unable to complete with a different task type.