cplusplus / sender-receiver

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

Lifetime guarantees of a sender's queryable environment #67

Open ericniebler opened 11 months ago

ericniebler commented 11 months ago

Issue by ericniebler Monday Feb 13, 2023 at 16:22 GMT Originally opened as https://github.com/NVIDIA/stdexec/issues/764


It's clear that a receiver's environment should have reference semantics. But is that also true for a sender's? Might it not be sometimes desirable to copy a sender's environment into the operation state, letting go of the sender itself?

If so, a sender's environment needs value semantics, or else a way to "deep copy" the environment. The latter could be as simple as a way of enumerating the queries that an environment supports, which could be useful elsewhere as well; e.g., it could be useful in a facility that generates type-erased wrappers for queryables.

ericniebler commented 11 months ago

Comment by Runner-2019 Monday Feb 27, 2023 at 02:09 GMT


mark

inbal2l commented 4 months ago

@ericniebler @lewissbaker @kirkshoop am I correct to assume that this is addressed in: https://isocpp.org/files/papers/P3325R0.html#by-value-vs.-by-reference

If not, there's a section in the roadmap - "Generalised Environment/Queryable Facilities (P3121)" under which there's "Enumerating queries" section addressing the Env lifetime, so in any case, I'm marking this as P0.

lewissbaker commented 4 months ago

@ericniebler @lewissbaker @kirkshoop am I correct to assume that this is addressed in: https://isocpp.org/files/papers/P3325R0.html#by-value-vs.-by-reference

This issue is not addressed by P3325.

The linked section of P3325 is referring to whether or not the env object itself should capture by reference or by value.

This issue is more about being able to take a sender's attributes and copy them and whether or not the copies should be valid after the sender itself is destroyed. i.e. can you take an independent copy of a sender's attributes?

If not, there's a section in the roadmap - "Generalised Environment/Queryable Facilities (P3121)" under which there's "Enumerating queries" section addressing the Env lifetime, so in any case, I'm marking this as P0.

Yes, the suggestion is that having the ability to enumerate the queries means that you can then construct an algorithm that can construct a new environment that contains copies of all of the query values. So I think it needs something like the generalised environment/queryable facility.

lewissbaker commented 4 months ago

See #191 for the generalised environment work.

inbal2l commented 2 months ago

Facilities/issues not described in P3325R0 which will require a followup paper:

  1. Ability to enumerate the queries (in order to construct an algorithm with a new environment that contains copies of all of the query values)
  2. Take a sender's attributes and assign them to a new sender (+ lifetime after the original sender is destroyed)