cplusplus / sender-receiver

Issues list for P2300
Apache License 2.0
20 stars 3 forks source link

sync_wait not handling void senders #131

Closed ericniebler closed 3 months ago

ericniebler commented 10 months ago

Issue by ericniebler Friday Oct 29, 2021 at 20:50 GMT Originally opened as https://github.com/NVIDIA/stdexec/issues/228


The return type of sync_wait is defined with:

template<typed_sender S>
  using sync-wait-type = optional<
    typename execution::sender_traits<remove_cvref_t<S>>
      ::template value_types<tuple, type_identity_t>>;

For a sender like just_done(), value_types is defined as:

template <template<class...> class, template<class...> class Variant>
using value_types = Variant<>;

The result of sync_wait(just_done()) is a hard error because type_identity_t cannot be instantiated with 0 parameters.

If we decide we want this to compiler, we either need to change sync_wait or just_done.

ericniebler commented 10 months ago

Comment by griwes Friday Oct 29, 2021 at 20:58 GMT


IMHO this is fine. When we discussed the shape of sync_wait before deciding on what's in the paper, we've decided to make sync_wait only support senders that have a single set of values they send, and invented sync_wait_with_variant to handle them. If a user wants to sync_wait things like just_done(), they can use sync_wait_with_variant instead.

I'm okay with changing just_done() in some way to "fix" this (fix in quotes because I don't really think there's anything to fix here), but I would be against changing sync_wait - or at least against changing it in a way that makes the shape of the type returned from it not be exactly the same for all valid invocations of the algorithm.

lewissbaker commented 3 months ago

Closing as won't-fix.

As @griwes mentioned, we have sync_wait_with_variant to handle the edge-cases.