<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Issue 4204: specification of as-sndr2(Sig) in [exec.let] is incomplete</title>
<meta property="og:title" content="Issue 4204: specification of as-sndr2(Sig) in [exec.let] is incomplete">
<meta property="og:description" content="C++ library issue. Status: WP">
<meta property="og:url" content="https://cplusplus.github.io/LWG/issue4204.html">
<meta property="og:type" content="website">
<meta property="og:image" content="http://cplusplus.github.io/LWG/images/cpp_logo.png">
<meta property="og:image:alt" content="C++ logo">
<style>
  p {text-align:justify}
  li {text-align:justify}
  pre code.backtick::before { content: "`" }
  pre code.backtick::after { content: "`" }
  blockquote.note
  {
    background-color:#E0E0E0;
    padding-left: 15px;
    padding-right: 15px;
    padding-top: 1px;
    padding-bottom: 1px;
  }
  ins {background-color:#A0FFA0}
  del {background-color:#FFA0A0}
  table.issues-index { border: 1px solid; border-collapse: collapse; }
  table.issues-index th { text-align: center; padding: 4px; border: 1px solid; }
  table.issues-index td { padding: 4px; border: 1px solid; }
  table.issues-index td:nth-child(1) { text-align: right; }
  table.issues-index td:nth-child(2) { text-align: left; }
  table.issues-index td:nth-child(3) { text-align: left; }
  table.issues-index td:nth-child(4) { text-align: left; }
  table.issues-index td:nth-child(5) { text-align: center; }
  table.issues-index td:nth-child(6) { text-align: center; }
  table.issues-index td:nth-child(7) { text-align: left; }
  table.issues-index td:nth-child(5) span.no-pr { color: red; }
  @media (prefers-color-scheme: dark) {
     html {
        color: #ddd;
        background-color: black;
     }
     ins {
        background-color: #225522
     }
     del {
        background-color: #662222
     }
     a {
        color: #6af
     }
     a:visited {
        color: #6af
     }
     blockquote.note
     {
        background-color: rgba(255, 255, 255, .10)
     }
  }
</style>
</head>
<body>
<hr>
<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#WP">WP</a> status.</em></p>
<h3 id="4204"><a href="lwg-defects.html#4204">4204</a>. specification of <code><i>as-sndr2</i>(Sig)</code> in [exec.let] is incomplete</h3>
<p><b>Section:</b> 33.9.12.10 <a href="https://wg21.link/exec.let">[exec.let]</a> <b>Status:</b> <a href="lwg-active.html#WP">WP</a>
 <b>Submitter:</b> Eric Niebler <b>Opened:</b> 2025-02-03 <b>Last modified:</b> 2025-06-23</p>
<p><b>Priority: </b>1
</p>
<p><b>View all other</b> <a href="lwg-index.html#exec.let">issues</a> in [exec.let].</p>
<p><b>View all issues with</b> <a href="lwg-status.html#WP">WP</a> status.</p>
<p><b>Discussion:</b></p>
<p>
33.9.12.10 <a href="https://wg21.link/exec.let">[exec.let]</a>/p9 reads:
<blockquote>
Given a type <code class='backtick'>Tag</code> and a pack <code class='backtick'>Args</code>, let <code><i>as-sndr2</i></code>
be an alias template such that
<code><i>as-sndr2</i>&lt;Tag(Args...)&gt;</code>
denotes the type
<code><i>call-result-t</i>&lt;Fn, decay_t&lt;Args&gt;&amp;...&gt;</code>.
Then <code class='backtick'>ops2_variant_t</code> denotes the type
<pre><code> variant&lt;monostate, connect_result_t&lt;<i>as-sndr2</i>&lt;LetSigs&gt;, receiver2&lt;Rcvr, Env&gt;&gt;...&gt;
</code></pre>
except with duplicate types removed.
</blockquote>

The type <code class='backtick'>Env</code> is not specified. It should be <code class='backtick'>env_t</code> from paragraph 7.
</p>
<p>
Paragraphs 8, 9, and 10 only make sense in relation to the lambda in paragraph 7,
but that is not at all clear from the current wording.
I suggest making paragraphs 8, 9, and 10 sub-bullets of paragraph 7.
</p>

<p><i>[2025-02-07; Reflector poll]</i></p>

<p>
Set priority to 1 after reflector poll.
</p>

<p><i>[Hagenberg 2025-02-11; move to Ready]</i></p>

<p>Dropped the suggestion to nest p8-10 under p7.</p>

<p><i>[Sofia 2025-06-21; Status changed: Voting &rarr; WP.]</i></p>



<p id="res-4204"><b>Proposed resolution:</b></p>
<p>
This wording is relative to <a href="https://wg21.link/N5001" title=" Working Draft, Programming Languages — C++">N5001</a>.
</p>
<ol>
<li>
Change 33.9.12.10 <a href="https://wg21.link/exec.let">[exec.let]</a> as indicated:

<blockquote>
<p>
-7-
<code><i>impls-for</i>&lt;<i>decayed-typeof</i>&lt;<i>let-cpo</i>&gt;&gt;::<i>get-state</i></code>
is initialized with a callable object equivalent to the following:
<pre><code>
  []&lt;class Sndr, class Rcvr&gt;(Sndr&amp;&amp; sndr, Rcvr&amp; rcvr) requires <i>see below</i> {
    auto&amp; [_, fn, child] = sndr;
    using fn_t = decay_t&lt;decltype(fn)&gt;;
    using env_t = decltype(<i>let-env</i>(child));
    using args_variant_t = <i>see below</i>;
    using ops2_variant_t = <i>see below</i>;

    struct state-type {
      fn_t fn;                    <i>// exposition only</i>
      env_t env;                  <i>// exposition only</i>
      args_variant_t args;        <i>// exposition only</i>
      ops2_variant_t ops2;        <i>// exposition only</i>
    };
    return <i>state-type</i>{std::forward_like&lt;Sndr&gt;(fn), <i>let-env</i>(child), {}, {}};
  }
</code></pre>
</p>
<p>
-8-
Let <code class='backtick'>Sigs</code> be a pack of the arguments to the <code class='backtick'>completion_signatures</code>
specialization named by
<code>completion_signatures_of_t&lt;<i>child-type</i>&lt;Sndr&gt;,
env_of_t&lt;Rcvr&gt;&gt;</code>.
Let <code class='backtick'>LetSigs</code> be a pack of those types in <code class='backtick'>Sigs</code> with a return type of
<code><i>decayed-typeof</i>&lt;<i>set-cpo</i>&gt;</code>.
Let <code class='backtick'>as-tuple</code> be an alias template such that
<code><i>as-tuple</i>&lt;Tag(Args...)&gt;</code>
denotes the type <code><i>decayed-tuple</i>&lt;Args...&gt;</code>.
Then <code class='backtick'>args_variant_t</code> denotes the type
<code>variant&lt;monostate, <i>as-tuple</i>&lt;LetSigs&gt;...&gt;</code>
except with duplicate types removed.
</p>
<p>
-9-
Given a type <code class='backtick'>Tag</code> and a pack <code class='backtick'>Args</code>, let <code><i>as-sndr2</i></code>
be an alias template such that
<code><i>as-sndr2</i>&lt;Tag(Args...)&gt;</code>
denotes the type
<code><i>call-result-t</i>&lt;Fn, decay_t&lt;Args&gt;&amp;...&gt;</code>.
Then <code class='backtick'>ops2_variant_t</code> denotes the type
<pre><code> variant&lt;monostate, connect_result_t&lt;<i>as-sndr2</i>&lt;LetSigs&gt;, receiver2&lt;Rcvr, <del>Env</del><ins>env_t</ins>&gt;&gt;...&gt;
</code></pre>
except with duplicate types removed.
</p>
<p>
-10-
The <i>requires-clause</i> constraining the above lambda is satisfied
if and only if the types <code class='backtick'>args_variant_t</code> and <code class='backtick'>ops2_variant_t</code> are well-formed.
</p>
</blockquote>

</li>
</ol>





</body>
</html>
