async/await in F#

Rikki Cattermole via Digitalmars-d digitalmars-d at puremagic.com
Sat Jun 14 19:56:28 PDT 2014


On 14/06/2014 7:53 p.m., bearophile wrote:
> In this post:
> http://forum.dlang.org/post/l62466$2n8p$1@digitalmars.com
>
> Walter said, in November:
>
>> I agree that async/await has to eventually be added to D. I'm not
>> convinced it can or should be done with AST macros.
>
>
> But this blog post shows why the rigid features of C# are not always the
> best and the Computation Expressions of F# give more flexibility:
>
> https://mrange.wordpress.com/2014/05/29/why-i-wish-c-never-got-asyncawait/
>
>
> More info on the Computation Expressions of F# (found at the top of a
> Google search, but also found to be the best references on this topic):
>
> tomasp.net/academic/papers/computation-zoo/computation-zoo.pdf
>
> http://msdn.microsoft.com/en-us/library/dd233182.aspx
>
> http://en.wikibooks.org/wiki/F_Sharp_Programming/Computation_Expressions
>
> http://fsharpforfunandprofit.com/series/computation-expressions.html
>
> Bye,
> bearophile

There's actually an interesting research paper [0] I found during this 
semester about a similar topic.
Supposedly when used its able to speed up IO considerably.
Its possible with D as it stands to implement this (thanks to our 
foreach closures ext.). The only reason I haven't done so was because of 
reconstructing e.g. register state and thread sleeping overriding.

Basically while blocking instead of sleeping it will execute the next 
iteration of a loop. And then go back at the appropriate time. At least 
that is how I summarized it.

[0] http://www.barrelfish.org/barrelfish_oopsla11.pdf



More information about the Digitalmars-d mailing list