Skip to content

Some feedback based on integration experience #41

@glebov-andrey

Description

@glebov-andrey

Hi,

I've recently been integrating this task implementation into a project which already used a different sender-based coroutine implementation. In doing so, I've come across a number or issues, some of which are related to the specification directly. I've omitted anything already present in P3796R0.

  • promise_type::return_value() should probably have a default template parameter to support co_return {...}, i.e.:
template<class V = T>
void return_value(V&& value);
  • promise_type::await_transform(change_coroutine_scheduler): the spec uses exchange(SCHED(*this), scheduler_type(sch.scheduler)), but schedulers aren't guaranteed to be move-assignable. Is the intent to disallow such schedulers?
  • task::connect() (and task::as_awaitable() in this implementation) should be rvalue-ref-qualified because they move handle
  • task_scheduler::ts-sender::connect should probably be rvalue-ref qualified, because there is no guarantee that the wrapped scheduler's sender is const &-connectable. Also, perhaps the spec should say connect(std::move(SENDER(*this)), std::move(r)) (adding std::move() around the wrapped sender)?
  • as_awaitable::result (and result_type::result in this implementation): is it a good idea to use std::monostate as an "empty" type. What if the user wants to have their value type be std::monostate? (I know this is a weird edge case, but I actually came across it).

There are also a number of issues with this implementation specifically. I can create a separate issue for them if that would be helpful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions