Second Draft: Coroutines
Richard (Rikki) Andrew Cattermole
richard at cattermole.co.nz
Thu Jan 23 17:14:50 UTC 2025
On 24/01/2025 4:55 AM, Sebastiaan Koppe wrote:
> On Thursday, 23 January 2025 at 09:49:54 UTC, Richard (Rikki) Andrew
> Cattermole wrote:
>>
>> On 23/01/2025 10:00 PM, Sebastiaan Koppe wrote:
>>> A good starting point would be the official reference https://
>>> en.cppreference.com/w/cpp/language/coroutines
>>
>> I didn't seen anything worth adding. So I haven't.
>
> I wouldn't dismiss it so easily. For one it explains the mechanism by
> which suspended coroutines can get scheduled again, whereas your DIP
> only mentioned the `WaitingOn` but doesn't go into detail how it
> actually works.
Ahhh ok, you are looking for a statement to the effect of: "A coroutine
may only be executed if it is not complete and if it has a dependency
for that to be complete or have a value."
The reason it is not in the DIP is because this a library behavior.
On the language side there is no such guarantee, you should be free to
execute them repeatedly without error. There could be logic bugs, but
the compiler cannot know that this is the case.
About the only time the compiler should prevent you from calling it is
if there is no transition to execute (such as it is now complete).
More information about the dip.development
mailing list