4 ms·
Users of coroutine-friendly libraries will have to adopt the async function coloring (co_await, co_yield, co_return, Task<T>). So saying that coroutines are l
by mrfox321 4y ago
Users of coroutine-friendly libraries will have to adopt the async function coloring (co_await, co_yield, co_return, Task<T>).
So saying that coroutines are low-level / not application code is misguided.
- nly 4y agoNot necessarily. Coroutines are invisible at the ABI level (that is coroutines are just functions). It's pretty easy to write a library with them (using your own executor) and not reveal their use to the user. Obviously sharing an executor between application and library is another matter.
- Joker_vD 4y ago> sharing an executor between application and library is another matter. Especially when there is not one, but several libraries, and the application itself doesn't actually has or uses any executors, now that's a fun challenge.
- mrfox321 4y agoGood point. Although doesn't that defeat the purpose of structured concurrency? i.e. creating tasks that are plumbed to some background thread/executor. By directly invoking the coroutine, lifetime issues become much easier to avoid.