More async-workflow features
Right now there is a big lack in the async-workflow if you compare it with C#/VB.nets implementation: you just cannot wait one-of-many results and there is no good timeout-support. You allways have to switch back into the Task-world.
Tomas Petricek had some great-ideas (see here: http://tomasp.net/blog/fsharp-variations-joinads.aspx) - I had hoped to see some of this in the new releases but alas no love for us poor pure functional lovers.
6 comments
-
Jack Fox
commented
As Kirill Katsnelson points out, joinads is not strictly an async workflow feature, but a useful workflow extension for composable functional programming.
-
Kirill Katsnelson
commented
The feature that Tomas has created is not limited to asynchronous workflows. It is rather a generic monad builder extensions, consisting of the match! statement and a ? match pattern. Not only it allows for very expressive parallelism syntax, but also powerful in language parsing and agent programming monads. It extends F# idiom with new, powerful and clear expression, and I can't wait for it to be integrated into the mainstream F# compiler.
-
Carsten König commented
@Daniel Robinson: Cancellation-Support is not bad, but because the calls are tupled you cannot use |> operators, but this is a minor problem.
The bigger problem is with Timeout - for example: yes there is a timeout for StartAsChild but this will only matter *after* the child-workflow finishes - so if you want a timeout of 5s but the computation takes 20s you get a timeout after 20(!)s ... well -
Tomas Petricek
commented
For those who are interested in this idea, a research version of F# with "joinads" can be now tried in the web browser (using Silverlight-based F# console). The examples include asynchronous workflows, but also other computations (agents, tasks, etc.) Visit: http://tryjoinads.org
-
Daniel Robinson
commented
I don't understand this suggestion. Timeout/cancellation support is actually really good, which, by the way, facilitates awaiting "one of many results"--i.e., the first task to complete, if given the cancellation token, can cancel the other computations. For example: http://stackoverflow.com/a/6804733/162396
-
Ryan Riley
commented
This is strictly related to the computation expression syntax, right? Or do you refer to the Async<_> type itself? I ask because I think a lot of these features could probably be added today, though not supported in the computation expression syntax.