This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of WP status.
default_domain::transform_env should be returning FWD-ENV(env)Section: 33.9.5 [exec.domain.default] Status: WP Submitter: Eric Niebler Opened: 2025-02-07 Last modified: 2025-06-23
Priority: Not Prioritized
View all other issues in [exec.domain.default].
View all issues with WP status.
Discussion:
Imported from cplusplus/sender-receiver #168.
When writing a generic recursive sender transform, you need to ability to unpack an unknown sender
S and recursively transform the children.
S will use when connecting its
child senders, which is why transform_env exists.
For an environment E and a sender S with tag T child C, the expression
default_domain().transform_env(S, E) should return an environment E2 that is identical to the
environment of the receiver that S uses to connect C.
default_domain().transform_env(S, E) will first check whether T().transform_env(S, E) is
well-formed. If so, it will return that (e.g. when_all_t has a transform_env that adds a stop token
to the environment).
If T().transform_env(S, E) is not well-formed, what should default_domain::transform_env do? At
present, it returns E unmodified.
But 33.9.12.1 [exec.adapt.general] has this:
[unless otherwise specified, when] a parent sender is connected to a receiver
rcvr, any receiver used to connect a child sender has an associated environment equal toFWD-ENV(get_env(rcvr)).
So the correct thing for default_domain::transform_env to do is to return FWD-ENV(get_env(rcvr)).
[Hagenberg 2025-02-11; move to Ready]
[Sofia 2025-06-21; Status changed: Voting → WP.]
Proposed resolution:
This wording is relative to N5001.
Modify 33.9.5 [exec.domain.default] as indicated:
template<sender Sndr, queryable Env> constexpr queryable decltype(auto) transform_env(Sndr&& sndr, Env&& env) noexcept;-5- Let
ebe the expressiontag_of_t<Sndr>().transform_env(std::forward<Sndr>(sndr), std::forward<Env>(env))if that expression is well-formed; otherwise,
-6- Mandates:.static_cast<Env>FWD-ENV(std::forward<Env>(env))noexcept(e)istrue. -7- Returns:e.