Skip to content

remove get_completion_signatures #246

Open
@ericniebler

Description

@ericniebler

it is desirable to compute completion signatures with the type of the receiver instead of with the environment only, as is done in P2300R9. this makes it possible to know whether connect(sndr, rcvr) can throw, which can effect the sender's completion signatures.

the easiest solution is to remove get_completion_signatures and put the completion signatures in the operation state as a nested typedef. doing that involves the following:

  1. change the operation_state concept to require types to have a nested ::completion_signatures alias that denotes a specialization of the completion_signatures<> class template.
     template<class O>
     concept operation_state =
       derived_from<typename O::operation_state_concept, operation_state_t> &&
       valid-completion-signatures<typename O::completion_signatures> &&
       requires (O& o) {
         { start(o) } noexcept;
       };
  2. remove the mandate that connect return an operation state.
  3. add a ::completion_signatures alias to operation-state-task
  4. add a type receiver_archetype as follows:
    struct receiver_archetype {
      using receiver_concept = receiver_t;
      void set_value(auto&&...) noexcept;
      void set_error(auto&&) noexcept;
      void set_stopped() noexcept;
      empty_env get_env() const noexcept;
    };
  5. change completion_signatures_of_t to take a sender type and a receiver type. default the receiver parameter to receiver_archetype. Make similar changes to value_types_of_t, error_types_of_t and sends_stopped.
  6. remove the sender_in concept
  7. change the sender_to concept as follows:
     template<class Sndr, class Rcvr>
     concept sender_to =
       sender<Sndr> &&
       receiver_of<Rcvr, completion_signatures_of_t<Sndr, Rcvr>> &&
       requires (Sndr&& sndr, Rcvr&& rcvr) {
         { connect(std::forward<Sndr>(sndr), std::forward<Rcvr>(rcvr)) }
           -> operation_state;
       };   
  8. change sender-of and sender-of-in as follows:
     template<class Sndr, class Rcvr, class... Values>
     concept sender-of-to =
       sender_to<Sndr, Rcvr> &&
       MATCHING-SIG( // see [exec.general]
         set_value_t(Values...),
         value_types_of_t<Sndr, Rcvr, value-signature, type_identity_t>);
    
     template<class Sndr, class... Values>
     concept sender-of = sender-of-in<Sndr, receiver_archetype, Values...>;
  9. change all prose referring to the sender_in concept to instead use sender_to with an appropriate receiver type.
  10. figure out if transform_sender and transform_env need to change.
  11. in the specification of let_value, change let-bind to conditionally handle an exception from connect.
  12. change transform_completion_signatures to propagate type errors.
  13. probably more ...

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions