20:30 the image in slide 13 was taken/borrowed from an awesome talk by Kevlin Henney. kzbin.info/www/bejne/qWPddn99q7OfmKMh4m12s
@KX365 ай бұрын
Thanks. I tried to find this from the info in the video but couldn't. I was hoping Kevlin had some different angle on coroutines that would make them more understandable but unfortunately not in that talk.
@User-cv4ee3 ай бұрын
@17:35 Can function D suspend coroutine C and return the handle to function B and resume from there? What happens to the stub for C, which is squeezed between D and B on the stack, when we are in function B then?
@Roibarkan2 ай бұрын
With stackless coroutines (what we have in C++20) it's not possible for a "regular function" (such as D in this slide) to cause suspension (run co_await or co_yield), for exactly the reason you describe - there's no room to hold its state. Only a coroutine can get suspended and thus the top of the stack is a 'coroutine stub'
@User-cv4ee2 ай бұрын
@@Roibarkan How about D calls "C_return_type".wait() (assume `wait` is the API exposed by C's return type that just suspends forever) and moves it through a normal return to B?
@Roibarkan Жыл бұрын
54:12 Excuse the English - I guess ‘aspirational’ is a better phrasing than ‘inspirational’
@randall172 Жыл бұрын
would python's asyncio be a good start pointt for gaining an intuition on coroutines?
@Roibarkan Жыл бұрын
I’m not an expert on python. My brief understanding is that python asyncio is somewhat more high-level than c++ coroutines, and thus python coroutines are probably easier to work with, but potentially less flexible. If one is accustomed to python coroutines- they can be sure that the same model can be done in c++ (and I would look at the asio library and cppcoro as starting points). I do not think that python asyncio supports symmetric transfer, for example, but I’m not sure. Thanks for the question
@brynyard Жыл бұрын
Very good overview of coroutines, but a lot of the questions underway should've been suspended as the answer was just a couple of slides down the line, and yet others was on a completely different tangent/world/fantasy concept, and as such just big distraction from the otherwise well structured talk.
@KX365 ай бұрын
I think the middle of the talk would be great separated out and slowed down into an intermediate level talk for people who already know the structure and basic use of coroutines and std::generator. The live audience of this talk seemed to require a more introductory talk first.