Skip to content

Commit 79f3a02

Browse files
committed
New issue from Eric: "Wording needs to ensure that in connect(sndr, rcvr) that rcvr expression is only evaluated once"
1 parent 6087fbc commit 79f3a02

File tree

1 file changed

+62
-0
lines changed

1 file changed

+62
-0
lines changed

xml/issue4208.xml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
<?xml version='1.0' encoding='utf-8' standalone='no'?>
2+
<!DOCTYPE issue SYSTEM "lwg-issue.dtd">
3+
4+
<issue num="4208" status="New">
5+
<title>Wording needs to ensure that in `connect(sndr, rcvr)` that `rcvr` expression is only evaluated once</title>
6+
<section><sref ref="[exec.connect]"/></section>
7+
<submitter>Eric Niebler</submitter>
8+
<date>07 Feb 2025</date>
9+
<priority>99</priority>
10+
11+
<discussion>
12+
<p>
13+
Imported from <a href="https://github.com/cplusplus/sender-receiver/issues/325">cplusplus/sender-receiver #325</a>.
14+
</p>
15+
<p>
16+
The current wording of `connect(sndr, rcvr)` defines the `new_sndr` expression as
17+
<tt>transform_sender(decltype(<i>get-domain-late</i>(sndr, get_env(rcvr))){}, sndr, get_env(rcvr))</tt>.
18+
<p/>
19+
It then defines `connect(sndr, rcvr)` as expression equivalent to `new_sndr.connect(rcvr)`.
20+
<p/>
21+
As currently worded, this requires evaluating the `rcvr` expression twice. Note that the first
22+
usage in the `new_sndr` expression is unevaluated, but the second usage in `get_env(rcvr)` is evaluated.
23+
<p/>
24+
I think we need to add an extra sentence at the end of this section saying "Where the expression
25+
`rcvr` is only evaluated once." or similar.
26+
</p>
27+
</discussion>
28+
29+
<resolution>
30+
<p>
31+
This wording is relative to <paper num="N5001"/>.
32+
</p>
33+
34+
<ol>
35+
<li>
36+
<p>Modify <sref ref="[exec.connect]"/> as indicated:</p>
37+
38+
<blockquote>
39+
<p>
40+
-6- The expression `connect(sndr, rcvr)` is expression-equivalent to:
41+
</p>
42+
<ol style="list-style-type: none">
43+
<li><p>(6.1) &mdash; `new_sndr.connect(rcvr)` if that expression is well-formed.
44+
<p/>
45+
<i>Mandates</i>: The type of the expression above satisfies `operation_state`.
46+
</p>
47+
</li>
48+
<li><p>(6.2) &mdash; Otherwise, <tt><i>connect-awaitable</i>(new_sndr, rcvr)</tt>.</p></li>
49+
</ol>
50+
<p>
51+
<ins>except that `rcvr` is evaluated only once.</ins>
52+
<p/>
53+
<i>Mandates</i>: <tt>sender&lt;Sndr&gt; &amp;&amp; receiver&lt;Rcvr&gt;</tt> is <tt>true</tt>.
54+
<p/>
55+
</p>
56+
</blockquote>
57+
</li>
58+
</ol>
59+
60+
</resolution>
61+
62+
</issue>

0 commit comments

Comments
 (0)