Skip to content

Should let_value destroy its predecessor operation-state eagerly to allow storage reuse? #287

Open
@lewissbaker

Description

@lewissbaker

The current specification of let_value requires implementations to keep the operation-state from the predecessor input sender alive until the let_value operation-state is destroyed.

This means that implementations cannot reuse the storage from the predecessor operation-state for the operation-state of the successor operation, increasing the overall storage size required for the let_value operation-state.

This is related to #239 and #70.

Note that the current design is a deviation from what was implemented in libunifex, which does reuse the storage and does destroy the predecessor operation-state and construct the successor operation-state at the same location. The reference implementation in stdexec follows what has been specified.

Is this design/behaviour intended? Or is it just a side-effect of implementing it in terms of basic-sender, which does not support manual-management of lifetimes of child operation states?

The semantics of when the child operation state is destroyed are observable by the user and so we should be clear about what is intended here.

The P2300R10 paper does not discuss this aspect of the design at all: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p2300r10.html#design-sender-adaptor-let

Metadata

Metadata

Assignees

No one assigned

    Labels

    P0designdiscussionWe need to talk about this; there's nothing actionable here yet

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions