Skip to content

Commit c0045d2

Browse files
author
github-actions
committed
Automatic update from GitHub Actions workflow
1 parent ce9e389 commit c0045d2

22 files changed

+436
-41
lines changed

issue4209.html

Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<title>Issue 4209: default_domain::transform_env should be returning FWD-ENV(env)</title>
6+
<meta property="og:title" content="Issue 4209: default_domain::transform_env should be returning FWD-ENV(env)">
7+
<meta property="og:description" content="C++ library issue. Status: New">
8+
<meta property="og:url" content="https://cplusplus.github.io/LWG/issue4209.html">
9+
<meta property="og:type" content="website">
10+
<meta property="og:image" content="http://cplusplus.github.io/LWG/images/cpp_logo.png">
11+
<meta property="og:image:alt" content="C++ logo">
12+
<style>
13+
p {text-align:justify}
14+
li {text-align:justify}
15+
pre code.backtick::before { content: "`" }
16+
pre code.backtick::after { content: "`" }
17+
blockquote.note
18+
{
19+
background-color:#E0E0E0;
20+
padding-left: 15px;
21+
padding-right: 15px;
22+
padding-top: 1px;
23+
padding-bottom: 1px;
24+
}
25+
ins {background-color:#A0FFA0}
26+
del {background-color:#FFA0A0}
27+
table.issues-index { border: 1px solid; border-collapse: collapse; }
28+
table.issues-index th { text-align: center; padding: 4px; border: 1px solid; }
29+
table.issues-index td { padding: 4px; border: 1px solid; }
30+
table.issues-index td:nth-child(1) { text-align: right; }
31+
table.issues-index td:nth-child(2) { text-align: left; }
32+
table.issues-index td:nth-child(3) { text-align: left; }
33+
table.issues-index td:nth-child(4) { text-align: left; }
34+
table.issues-index td:nth-child(5) { text-align: center; }
35+
table.issues-index td:nth-child(6) { text-align: center; }
36+
table.issues-index td:nth-child(7) { text-align: left; }
37+
table.issues-index td:nth-child(5) span.no-pr { color: red; }
38+
@media (prefers-color-scheme: dark) {
39+
html {
40+
color: #ddd;
41+
background-color: black;
42+
}
43+
ins {
44+
background-color: #225522
45+
}
46+
del {
47+
background-color: #662222
48+
}
49+
a {
50+
color: #6af
51+
}
52+
a:visited {
53+
color: #6af
54+
}
55+
blockquote.note
56+
{
57+
background-color: rgba(255, 255, 255, .10)
58+
}
59+
}
60+
</style>
61+
</head>
62+
<body>
63+
<hr>
64+
<p><em>This page is a snapshot from the LWG issues list, see the <a href="lwg-active.html">Library Active Issues List</a> for more information and the meaning of <a href="lwg-active.html#New">New</a> status.</em></p>
65+
<h3 id="4209"><a href="lwg-active.html#4209">4209</a>. <code>default_domain::transform_env</code> should be returning <code><i>FWD-ENV</i>(env)</code></h3>
66+
<p><b>Section:</b> 33.9.5 <a href="https://wg21.link/exec.domain.default">[exec.domain.default]</a> <b>Status:</b> <a href="lwg-active.html#New">New</a>
67+
<b>Submitter:</b> Eric Niebler <b>Opened:</b> 2025-02-07 <b>Last modified:</b> 2025-02-09</p>
68+
<p><b>Priority: </b>Not Prioritized
69+
</p>
70+
<p><b>View all issues with</b> <a href="lwg-status.html#New">New</a> status.</p>
71+
<p><b>Discussion:</b></p>
72+
<p>
73+
Imported from <a href="https://github.com/cplusplus/sender-receiver/issues/168">cplusplus/sender-receiver #168</a>.
74+
</p>
75+
<p>
76+
When writing a generic recursive sender transform, you need to ability to unpack an unknown sender
77+
<code class='backtick'>S</code> and recursively transform the children.
78+
<p/>
79+
For that, it can be useful to know the type of the environment that <code class='backtick'>S</code> will use when connecting its
80+
child senders, which is why <code class='backtick'>transform_env</code> exists.
81+
<p/>
82+
For an environment <code class='backtick'>E</code> and a sender <code class='backtick'>S</code> with tag <code class='backtick'>T</code> child <code class='backtick'>C</code>, the expression
83+
<code class='backtick'>default_domain().transform_env(S, E)</code> should return an environment <code class='backtick'>E2</code> that is identical to the
84+
environment of the receiver that <code class='backtick'>S</code> uses to connect <code class='backtick'>C</code>.
85+
<p/>
86+
<code class='backtick'>default_domain().transform_env(S, E)</code> will first check whether <code class='backtick'>T().transform_env(S, E)</code> is
87+
well-formed. If so, it will return that (e.g. <code class='backtick'>when_all_t</code> has a <code class='backtick'>transform_env</code> that adds a stop token
88+
to the environment).
89+
<p/>
90+
If <code class='backtick'>T().transform_env(S, E)</code> is not well-formed, what should <code class='backtick'>default_domain::transform_env</code> do? At
91+
present, it returns <code class='backtick'>E</code> unmodified.
92+
<p/>
93+
But 33.9.12.1 <a href="https://wg21.link/exec.adapt.general">[exec.adapt.general]</a> has this:
94+
</p>
95+
<blockquote style="border-left: 3px solid #ccc;padding-left: 15px;">
96+
<p>
97+
[unless otherwise specified, when] a parent sender is connected to a receiver <code class='backtick'>rcvr</code>, any receiver used
98+
to connect a child sender has an associated environment equal to <code><i>FWD-ENV</i>(get_env(rcvr))</code>.
99+
</p>
100+
</blockquote>
101+
<p>
102+
So the correct thing for <code class='backtick'>default_domain::transform_env</code> to do is to return <code><i>FWD-ENV</i>(get_env(rcvr))</code>.
103+
</p>
104+
105+
106+
<p id="res-4209"><b>Proposed resolution:</b></p>
107+
<p>
108+
This wording is relative to <a href="https://wg21.link/N5001">N5001</a>.
109+
</p>
110+
111+
<ol>
112+
<li>
113+
<p>Modify 33.9.5 <a href="https://wg21.link/exec.domain.default">[exec.domain.default]</a> as indicated:</p>
114+
115+
<blockquote>
116+
<pre>
117+
template&lt;sender Sndr, <i>queryable</i> Env&gt;
118+
constexpr <i>queryable</i> decltype(auto) transform_env(Sndr&amp;&amp; sndr, Env&amp;&amp; env) noexcept;
119+
</pre>
120+
<blockquote>
121+
<p>
122+
-5- Let <code class='backtick'>e</code> be the expression
123+
</p>
124+
<blockquote><pre>
125+
tag_of_t&lt;Sndr&gt;().transform_env(std::forward&lt;Sndr&gt;(sndr), std::forward&lt;Env&gt;(env))
126+
</pre></blockquote>
127+
<p>
128+
if that expression is well-formed; otherwise, <code><del>static_cast&lt;Env&gt;</del><ins><i>FWD-ENV</i></ins>(std::forward&lt;Env&gt;(env))</code>.
129+
<p/>
130+
-6- <i>Mandates</i>: <code class='backtick'>noexcept(e)</code> is <code class='backtick'>true</code>.
131+
<p/>
132+
-7- <i>Returns</i>: <code class='backtick'>e</code>.
133+
</p>
134+
</blockquote>
135+
</blockquote>
136+
</li>
137+
</ol>
138+
139+
140+
141+
142+
143+
144+
</body>
145+
</html>

0 commit comments

Comments
 (0)