The current wording of let_value, let_error, let_stopped defines a recevier2 type that is intended to be connected to the sender returned from invoking the Fn with the result of the first sender.
As currently defined, the receiver2 holds as a base-class sub-object, the receiver passed to connect() on the let_value sender. The motivation here being that the child operation can just directly call the parent receiver's completion signal.
However, this is problematic in the case that connect() on the child operation fails with an exception.
The let_value operation must move-construct the receiver into the receiver2 object and then pass that receiver2 object into the connect() call on the second sender.
However, if that connect() call exits with an exception, then the let_value operation now needs to complete the operation as a whole with set_error(), but cannot because the receiver that needs to receive the result is now in a moved-from state.
Instead, we should store the parent receiver in the operation-state and then have receiver2 hold a pointer to the operation state. That way, if we end up discarding receiver2 due to the child connect() all throwing an exception, then we still have a way to call the parent receiver.
The current wording of
let_value
,let_error
,let_stopped
defines arecevier2
type that is intended to be connected to the sender returned from invoking theFn
with the result of the first sender.As currently defined, the
receiver2
holds as a base-class sub-object, the receiver passed toconnect()
on thelet_value
sender. The motivation here being that the child operation can just directly call the parent receiver's completion signal.However, this is problematic in the case that
connect()
on the child operation fails with an exception. Thelet_value
operation must move-construct the receiver into thereceiver2
object and then pass thatreceiver2
object into theconnect()
call on the second sender.However, if that
connect()
call exits with an exception, then thelet_value
operation now needs to complete the operation as a whole withset_error()
, but cannot because the receiver that needs to receive the result is now in a moved-from state.Instead, we should store the parent receiver in the operation-state and then have
receiver2
hold a pointer to the operation state. That way, if we end up discardingreceiver2
due to the childconnect()
all throwing an exception, then we still have a way to call the parent receiver.