Skip to content

Does basic-receiver need to constrain set_value/set_error/set_stopped on whether complete is invocable? #292

Open
@lewissbaker

Description

@lewissbaker

The current specification for the exposition-only class basic-receiver defines its completion-functions to be constrained based on whether the impls-for<tag-t>::complete function is invocable.

For example:

  template<class Sndr, class Rcvr, class Index>
    requires valid-specialization<env-type, Index, Sndr, Rcvr>
  struct basic-receiver {                                       // exposition only
    using receiver_concept = receiver_t;

    using tag-t = tag_of_t<Sndr>;                               // exposition only
    using state-t = state-type<Sndr, Rcvr>;                     // exposition only
    static constexpr const auto& complete = impls-for<tag-t>::complete;   // exposition only

    template<class... Args>
      requires callable<decltype(complete), Index, state-t&, Rcvr&, set_value_t, Args...>
    void set_value(Args&&... args) && noexcept {
      complete(Index(), op->state, op->rcvr, set_value_t(), std::forward<Args>(args)...);
    }

    // ...

    basic-state<Sndr, Rcvr>* op;                           // exposition only
  };

Since a sender/operation is not allowed to form a call to set_value unless that completion-signature is listed in its set of completion-signatures, shouldn't we be using mandates instead of constraints here?

Is there any benefit to putting the constraints/requires-clause on the set_value/set_error/set_stopped functions?

Metadata

Metadata

Assignees

No one assigned

    Labels

    discussionWe need to talk about this; there's nothing actionable here yetwording

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions