4 ms·
> "async fn" is even misleading since the function itself returns synchronously (and immediately): it's the returned value where the async-ness lies. You've go
by Rusky 5y ago
> "async fn" is even misleading since the function itself returns synchronously (and immediately): it's the returned value where the async-ness lies.
You've got the causality backwards- it's the async-ness that causes it to return immediately. Async is primarily about the execution model of the entire function, and the return type is only changed in service of that model.
The course of the design discussions started without async or await, using library-based Future combinators. Async was introduced as a way to desugar control flow and move knowledge of Futures into the compiler for borrow checking reasons, not out of any intention to mimic C#.
- ridiculous_fish 5y agoYou're quite correct, I hadn't thought of the fact that the transform and the return type were distinct. My mistake.