3 ms·
I guess you mean fibers (which require call stack switching). That's one way to implement coroutines, but most languages with async/await implement coroutines d
by flohofwoe 5y ago
I guess you mean fibers (which require call stack switching). That's one way to implement coroutines, but most languages with async/await implement coroutines differently by transforming async functions into a simple switch-case state machine (where each "yield block" is one case-branch) plus associated local state which doesn't live on the regular call stack. This code transformation is also the reason for "function coloring", which isn't needed for a fiber-based coroutine system.