GorNishanov / coroutines-ts

20 stars 2 forks source link

Wording change to rename await_transform -> await_value and make mandatory #34

Open lewissbaker opened 5 years ago

lewissbaker commented 5 years ago

For P1477R0

GorNishanov commented 5 years ago

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.

lewissbaker commented 5 years ago

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

GorNishanov commented 5 years ago

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 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

lewissbaker commented 5 years ago

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.