There's still one thing I don't understand, thoug. The docs say, the difference between the promise and the task type are in eagerness/laziness. But for generator, in the PR, laziness is enabled "manually" with co_await instruction. Couldn't the same be applied to the promise? Is there a value in encoding the laziness property in the type? If so, why the same argument would not apply to generator?
In theory, yes. But there's a bit more to it. tasks are taking their executor when they first get resumed, which allows them to get spawned onto another executor unlike promises. That's also reflected in their memory allocation. The promise starts running immediately and might resume something else (that awaits it) on completion. The generator will always get co_awaited and resumed by it's caller, by default on the first co_yield, so making the lazyness a run-time parameter with `co_await initial` is basically a co_yield that doesn't yield a value. So this change is minor and just changes the timing & the overhead is minimal. But note that I didn't merge it yet, so I am not a 100% sure either yet.