3 ms·
As I said in my previous post, a CPU that doesn't respect barriers and reorders the instructions anyway is a bugged CPU, not a modern one. If I need the databa
by tigershark 10y ago
As I said in my previous post, a CPU that doesn't respect barriers and reorders the instructions anyway is a bugged CPU, not a modern one.
If I need the database result before doing anything else then my code is inherently synchronous and it has an hard dependency on the database result.
In that context making the DB call asynchronous and waiting for it is more complex than making a synchronous call and proceeding with the normal program flow.
The most natural way to write an algorithm is to have everything synchronous and have a "simil-synchronisation" of the asynchronous program flow using an "async monad".
And sadly I normally use C# 4.0 that still doesn't have the async construct borrowed from F#, so I'm stuck with tasks and continuations.
- talles 10y ago> And sadly I normally use C# 4.0 that still doesn't have the async construct borrowed from F#, so I'm stuck with tasks and continuations. Do you know that the async/await constructs are just sugar for the Task class you have access on C# 4.0?
- tigershark 10y agoThe C# implementation is a wrap/unwrap of the Task class, in F# it is using computation expressions to lift the synchronous code to an Async monad. The async construct is much easier to reason about, especially with nested tasks.