-
Notifications
You must be signed in to change notification settings - Fork 224
Description
Two questions about some unexpected behaviours of the repeat_ family of senders in the exec namespace:
-
repeat_effectcompletely omits completion signatures.Although I presume this was done because the sender never completes on the value channel, it's counterintuitive and extremely limiting to omit the completion signatures. Where
repeat_effectmeans "repeat upstream sender until error or exception", I immediately presumed the completion signatures would simply never containset_value_t(). Without advertising completion signatures, any sender usingrepeat_effectessentially cannot be composed with any further senders. Examples that won't compile:auto snd_1 = stdexec::just_stopped() | exec::repeat_effect() | stdexec::upon_stopped([](){return -1;}); // cannot chain w/o completion_signatures
// starts_on tries to transform completion signatures that don't exist exec::timed_thread_context ctx{}; auto snd_2 = stdexec::starts_on(ctx.get_scheduler(), stdexec::just_stopped() | exec::repeat_effect());
Is this intentional or a bug? If it's intentional, how is
repeat_effectsupposed to be used? -
repeat_effect_untilandrepeat_naddstdexec::set_stopped_t()to the completion signatures.Where the upstream senders in the following two examples complete only on the value channel, why would the repeat adapters transform the completion signatures as such? I gather that the
stdexec::set_error_t(std::exception_ptr)signature is added to account for possible exceptions within therepeat_*machinery, and querying all the exception guarantees of creating the op-state to conditionally add an error channel would be difficult. Is the stop channel similarly added as a blanket solution?auto snd = stdexec::just(false) | exec::repeat_effect_until(); static_assert(std::same_as< stdexec::completion_signatures_of_t<decltype(snd)>, stdexec::completion_signatures< stdexec::set_stopped_t(), stdexec::set_error_t(std::exception_ptr), stdexec::set_value_t() > >); auto snd_n = stdexec::just() | exec::repeat_n(3); static_assert(std::same_as< stdexec::completion_signatures_of_t<decltype(snd_n)>, stdexec::completion_signatures< stdexec::set_value_t(), stdexec::set_stopped_t(), stdexec::set_error_t(std::exception_ptr) > >);
Thanks for any feedback!
Examples were tested with the current tip of main, 8cfc3f1