4 ms·
Coroutines aren't as flexible as continuation passing style and add significant overhead for the non-vital syntactic sugar they give you. I'd much rather expli
by davidhollander 15y ago
Coroutines aren't as flexible as continuation passing style and add significant overhead for the non-vital syntactic sugar they give you.
I'd much rather explicitly set an OnWrite event that has a one-to-one correspondence to a socket write event from a poll() system call, than create a ton of coroutines and juggle "resumes". This is especially true if you have a usecase where you want to start sending while you are still reading, this would require the creation of 2 coroutines per each context.
While Lua coroutines are significantly better than Python generators by having a more functional than syntactical "yield", I still feel it does more harm than good for structuring asynchronous applications.
- silentbicycle 15y agoCoroutines are less expressive than manually doing CPS, true, but they do make many common cases simpler. They're ultimately as expressive as one-shot continuations.