I wrote the following two functions:
let requestAsync qry = dispatcher.PostAndAsyncReply (fun chan -> Query (qry chan))
let request qry = qry |> requestAsync |> Async.RunSynchronously
Now I was wondering if I would have any incentive to writing request like this instead:
let request qry = dispatcher.PostAndReply (fun chan -> Query(qry chan))
I wasn’t able to decompile the two implementations and as such, I don’t know if the second one might be more efficient or whatnot.
The code is at
https://github.com/fsharp/fsharp/blob/master/src/fsharp/FSharp.Core/control.fs
though not exactly perspicuous… I don’t think there’s much difference; I would call
PostAndReply, but they’re both doing roughly the same thing and I would not expect a significant difference. (As always, if you care deeply, then measure for your exact scenario.)