I think that it would be useful to consider the existing (very very very large) body of research on dataflow PL and APIs; e.g. check this paper from 1982 which talks about dataflow, coroutines, for handling file operations:
- https://scholarship.claremont.edu/cgi/viewcontent.cgi?articl...
More recent papers in the field:
- https://hal.archives-ouvertes.fr/hal-02865894/document
- https://library.oapen.org/bitstream/handle/20.500.12657/3772...
and older general overviews of the field:
- http://www.cs.ucf.edu/~dcm/Teaching/COT4810-Spring2011/Liter...
- http://210.47.10.86:8032/200009-3/65492.pdf#page=141
My main concern with this design, even if the code looks quite neat, is that the actual dataflow graph is not reified, but exists "invisibly" as part of the program source through the way co_await calls are sequenced.
This means that it is not possible to do as an user, a static analysis and scheduling of the tasks : it relies on the compiler to perform this. But, this problem is in my experience quite often very use-case-specific and ridden with informations compilers do not possess. Not having the way tasks are interdependent reified in an actual user-manipulable "graph" object means that users won't have the possibility, to, say, perform a topological sort or flow propagation on their async graph in order to extract information on it that could be necessary to perform a domain-specific optimization of said graph (for instance if we know that a set of tasks are dependent on each other in ways that aren't visible on the source code, but are known to the programmers, it would make sense to schedule them on a queue in their own thread).