Title
Wording needs to ensure that in `connect(sndr, rcvr)` that `rcvr` expression is only evaluated once
Status
ready
Section
[exec.connect]
Submitter
Eric Niebler

Created on 2025-02-07.00:00:00 last changed 2 months ago

Messages

Date: 2025-02-11.17:35:18

Proposed resolution:

This wording is relative to N5001.

  1. Modify [exec.connect] as indicated:

    -6- The expression `connect(sndr, rcvr)` is expression-equivalent to:

    1. (6.1) — `new_sndr.connect(rcvr)` if that expression is well-formed.

      Mandates: The type of the expression above satisfies `operation_state`.

    2. (6.2) — Otherwise, connect-awaitable(new_sndr, rcvr).

    except that `rcvr` is evaluated only once.

    Mandates: sender<Sndr> && receiver<Rcvr> is true.

Date: 2025-02-11.17:35:18

[ Hagenberg 2025-02-11; move to Ready ]

Date: 2025-02-07.00:00:00

Imported from cplusplus/sender-receiver #325.

The current wording of `connect(sndr, rcvr)` defines the `new_sndr` expression as transform_sender(decltype(get-domain-late(sndr, get_env(rcvr))){}, sndr, get_env(rcvr)).

It then defines `connect(sndr, rcvr)` as expression equivalent to `new_sndr.connect(rcvr)`.

As currently worded, this requires evaluating the `rcvr` expression twice. Note that the first usage in the `new_sndr` expression is unevaluated, but the second usage in `get_env(rcvr)` is evaluated.

I think we need to add an extra sentence at the end of this section saying "Where the expression `rcvr` is only evaluated once." or similar.

History
Date User Action Args
2025-02-11 17:35:18adminsetmessages: + msg14636
2025-02-11 17:35:18adminsetstatus: new -> ready
2025-02-09 13:28:52adminsetmessages: + msg14626
2025-02-07 00:00:00admincreate