3 ms·
> It's not, they're two separate things. Unfortunately, nobody can agree on terminology for this stuff. There is standard terminology though. Coroutines allow
by naasking 10y ago
> It's not, they're two separate things. Unfortunately, nobody can agree on terminology for this stuff.
There is standard terminology though. Coroutines allow arbitrarily nested calls back and forth. So-called "stackful" coroutines are the only possibility in C. Other languages perform a program translation into continuation-passing style to support stackless coroutines with the same semantics.
CORO falls under a class of abstractions known as "generators". You can think of it like a degenerate coroutine limited to a single call level, but I don't think conflating the terminology like this is useful.
- codr4life 10y agoYou got it backwards though; all the name means is the subroutine has multiple entry points for suspending and resuming execution, which can be used to implement nonpreemptive threads, generators and other abstractions.