News for hackers. Stuff that matters.
Re:Philosophy of Coroutines by ttctciyf on Saturday September 02, 2023 @03:31AM (#37359254)
Maybe you missed that the article explicitly talks about the cloning/deep copy of coroutines:

> Using my C/C++ preprocessor coroutine system, this is perfectly possible. In that system, all the persistent variables of the coroutine – including the state variable that says where to resume from next – have to live in an explicitly declared structure (in C) or be members of a class (in C++). Either way, there’s no difficulty with making an exact copy [...]

> After you do that, you’ve got two copies of the coroutine, and each of them will resume from the same part of the code when it next runs [...] This isn’t a deliberate feature of my preprocessor system; it’s just a thing that drops out naturally from the implementation strategy

Resuming from an on-disk copy seems tougher - you need to supply all relevant execution context.

There are no comments on this comment yet.