coroutines-ts icon indicating copy to clipboard operation
coroutines-ts copied to clipboard

Wording change to rename await_transform -> await_value and make mandatory

Open lewissbaker opened this issue 5 years ago • 4 comments

For P1477R0

lewissbaker avatar Feb 06 '19 22:02 lewissbaker

Looks good, but, usability wise, we probably need some kind of =default for it. Any task type that does not do anything special for await_transform would need to lookup and paste the boilerplate for await_value. Source of bugs.

GorNishanov avatar Feb 06 '19 23:02 GorNishanov

Can the = default definition be added later or should we target that for this change too?

lewissbaker avatar Feb 07 '19 00:02 lewissbaker

Sure thing. I am not requesting a change. Just just expressing my "feelings" about this change. :-) Coroutine authors have to memorize this sequence by heart.

"template<typename U> U&& await_value(U&& value) { return static_cast<U&&>(value); } "

Note that in the p1477r0 detached task type forgot to include the await_value in its promise definition :-p

GorNishanov avatar Feb 07 '19 00:02 GorNishanov

I think it could be challenging to allow = default for an otherwise normal method. Maybe if it was named operator co_await() then it would be more palatable.

lewissbaker avatar Feb 07 '19 04:02 lewissbaker