4 ms·
> For coroutines, each coroutine needs its own stack. That means you have to have a dynamic memory system baked into the language. And maybe garbage collection
by eru 14y ago
> For coroutines, each coroutine needs its own stack. That means you have to have a dynamic memory system baked into the language. And maybe garbage collection too.
Why? Just statically give every co-routine it's own stack.
- csense 14y agoThe number of coroutine invocations, and the order in which they're cleaned up, could depend on user input. The former could be unbounded. More formally, I'm pretty sure you can write a program that always halts, but for every pair of large numbers N, K > 0, there are at least K different input values that result in (1) at least N coroutine invocations being simultaneously active, and (2) for each of those K different input values, those invocations finish in a different order.