<!DOCTYPE html> <!-- Draft 0.1 -->
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<meta name ="description" content="Proposal to immediately publish the existing draft for ISO C++ TS Library Fundamentals v3"/>
<meta name ="keywords" content="C++,cplusplus,TS,wg21,LWG,LEWG,Library Fundamentals"/>
<meta name ="author" content="Alisdair Meredith,Bryce Adelstein Lelbach"/>

<title>Publish TS Library Fundamentals 3 Now!</title>

<style>
    body { counter-reset: section; }

    h2 { counter-reset: subsection; }

    h2::before { counter-increment: section; content: counter(section) " "; }

    h2.uncounted::before { counter-increment: none; content: ""; }

    h3::before { counter-increment: subsection; content:  counter(section) "." counter(subsection) " "; }

    h3.uncounted::before { counter-increment: none; content: ""; }

    ins {background-color:#A0FFA0}
    del {background-color:#FFA0A0}
    p   {text-align:justify}
    li  {text-align:justify}

    ol.index           { counter-reset: item }
    ol.index li        { display: block }
    ol.index li:before { content: counters(item, ".") " "; counter-increment: item }

    ul.index           { counter-reset: depr }
    ul.index li        { display: block }
    ul.index li:before { content: counters(depr, ".") " "; counter-increment: depr }

    blockquote.note {
        background-color:#E0E0E0;
        padding-left: 15px; padding-right: 15px;
        padding-top:   1px; padding-bottom: 1px;
    }

    blockquote.recommend {
        background-color:#ffffb0;
        padding-left: 10px; padding-right: 10px;
        padding-top: 1px; padding-bottom: 1px;
    }

    blockquote.review {
        background-color:#c8ffc8;
        padding-left: 10px; padding-right: 10px;
        padding-top: 1px; padding-bottom: 1px;
    }

    blockquote.review_note {
        background-color:#ffffcc;
        padding-left: 15px; padding-right: 15px;
        padding-top: 1px; padding-bottom: 1px;
    }

    blockquote.draft_wording {
        background-color:#f8f8f8;
        padding-left: 15px; padding-right: 15px;
        padding-top: 1px; padding-bottom: 1px;
    }

    blockquote.old_wording {
        background-color:#f8f0f0;
        padding-left: 15px; padding-right: 15px;
        padding-top: 1px; padding-bottom: 1px;
    }

    blockquote.proposed_wording {
        background-color:#f8f8e8;
        padding-left: 15px; padding-right: 15px;
        padding-top: 1px; padding-bottom: 1px;
    }

    tr:nth-child(even) {background-color: #f2f2f2;}

    table.poll tr {background-color: #fcfcfc; text-align:center;}
    table.poll td {width: 20%;}
</style>
</head>

<body>
<table>
  <tr>
    <td>Doc. no.</td>
    <td>P2631R0</td>
  </tr>
  <tr>
    <td>Date:</td>
    <td>2022-09-12</td>
  </tr>
  <tr>
    <td>Project:</td>
    <td>Programming Language C++</td>
  </tr>
  <tr>
    <td>Audience:</td>
    <td>LEWG, LWG</td>
  </tr>
  <tr>
    <td>Reply to:</td>
    <td>
      Alisdair Meredith
      &lt;<a href="mailto:ameredith1@bloomberg.net">ameredith1@bloomberg.net</a>&gt;
    </td>
  </tr>
  <tr>
    <td> </td>
    <td>
      Bryce Adelstein Lelbach
      &lt;<a href="mailto:brycelelbach@gmail.com">brycelelbach@gmail.com</a>&gt;
    </td>
  </tr>
  <tr>
    <td> </td>
    <td>
      Jonathan Wakely
      &lt;<a href="mailto:cxx@kayari.org">cxx@kayari.org</a>&gt;
    </td>
  </tr>
</table>

<h1>Publish TS Library Fundamentals 3 Now!</h1>

<h2 class="uncounted">Table of Contents</h2>
<ul>
  <li>
    <a href="#rev.hist">Revision History</a>
    <ul>
      <li><a href="#rev.0">R0: Original</a></li>
    </ul>
  </li>
</ul>

<ol class="index">
<li>
  <a href="#1.0">Abstract</a>
</li>
<li>
  <a href="#2.0">Stating the problem</a>
  <ul class="index">
    <li><a href="#2.changes">How Much Has Changed?</a></li>
    <li><a href="#2.urgent">Why the Urgency?</a></li>
    <li><a href="#2.precedent">Do We Have Precedent?</a></li>
    <li><a href="#2.lost">What Do We Risk Losing?</a></li>
  </ul>
</li>
<li>
  <a href="#4.0">Other Directions</a>
  <ul class="index">
    <li><a href="#4.rebasec++23">Rebase Onto C++23</a></li>
    <li><a href="#4.mergec++23">Merge into C++23</a></li>
    <li><a href="#4.mergec++26">Merge into C++26</a></li>
    <li><a href="#4.abandon">Drop the TS Entirely</a></li>
  </ul>
</li>
<li>
  <a href="#5.0">Proposed Motion</a>
</li>
<li>
  <a href="#6.0">Acknowledgements</a>
</li> 
<li>
  <a href="#7.0">References</a>
</li>
</ol>


<h2 class="uncounted" id="rev.hist">Revision History</h2>

<blockquote>

<h3 class="uncounted" id="rev.0">R0: Original</h3>
<p>
Original version of the paper for the 2022 August mailing.
</p>

</blockquote>


<h2 id="1.0">Abstract</h2>
<p>
The current draft for the TS Library Fundamentals 3 is complete and up to date.
We should move to publish before C++23 requires further work for little benefit.
</p>


<h2 id="2.0">Stating the problem</h2>
<p>
The current TS Library Fundamentals v2 was published after ballot resolution at
the 2016 November Issaquah meeting.  It is based on the C++14 standard, so will
shortly be close to a decade out of date.  In the six year between Issaquah and
the 2022 November Kona meeting, the Library Working Groups have maintained and
evolved this TS; that work has mostly ceased, but the revised TS remains
unpublished.  We propose moving to expediently publish the current working
draft, and then removing TS Library Fundamentals from our list of active tasks.
</p>

<h3 id="2.changes">How Much Has Changed?</h3>
<p>
How is the Current Draft Different to the Current TS? Compared to TS Library
Fundamentals v2, we have:
</p>

<p>
Rebased from the <em>C++14</em> standard first onto the C++17 standard, and
later onto the C++20 standard.  This was a non-trivial task updating the
document to current library conventions, in particular replacing all
<i>Requires</i> clauses with <i>Mandates</i>, <i>Constraints</i>, and
<i>Preconditions</i> as appropriate, and updating all numbered cross references
into the base standard.  Additionally, we consistently switched from
<code>typedef</code> to <code>using</code> for type aliases, and use nested
namespace declarations to simplify header synopses etc.
</p>

<p>
Added one significant new experimental library (with a full implementation now
checked into gcc libstdc++ trunk):
</p>
<ul>
  <li><code>scope_exit</code></li>
  <li><code>scope_fail</code></li>
  <li><code>scope_success</code></li>
  <li><code>unique_resource</code></li>
</ul>

<p>
Removed the features that landed in the base standard, either C++17 or C++20:
</p>
<ul>
  <li><code>conjunction</code>, <code>disjunction</code>, <code>negation</code></li>
  <li><code>gcd</code>, lowest common multiple</li>
  <li>polymorphic memory resources</li>
  <li>searchers</li>
  <li><code>shared_ptr</code> support for arrays</li>
  <li>source location</li>
  <li><code>std::any</code></li>
  <li><code>std::apply</code></li>
  <li><code>std::array</code> creation functions</li>
  <li><code>std::not_fn</code></li>
  <li><code>std::optional</code></li>
  <li><code>std::string_view</code></li>
  <li>type trait variable templates</li>
  <li>uniform container erasure</li>
</ul>

<p>
Resolved a small set of issues filed over the 6 year development period:
</p>
<ul>
  <li>
<a href="https://cplusplus.github.io/LWG/lwg-defects.html#2960">#2960</a>
<code>nonesuch</code> is insufficiently useless
  </li>
  <li>
<a href="https://cplusplus.github.io/LWG/lwg-defects.html#3134">#3134</a>
LFTSv3 contains extraneous [meta] variable templates that should have been
deleted by P09961
  </li>
  <li>
<a href="https://cplusplus.github.io/LWG/lwg-defects.html#3135">#3135</a>
LFTSv3 contains two redundant alias templates
  </li>
  <li>
<a href="https://cplusplus.github.io/LWG/lwg-defects.html#3413">#3413</a>
<code>propagate_const</code>'s <code>swap</code>'s <code>noexcept</code>
specification needs to be constrained and use a trait
  </li>
  <li>
<a href="https://cplusplus.github.io/LWG/lwg-defects.html#3649">#3649</a>
Reinstate and bump <code>__cpp_lib_experimental_memory_resource</code> feature
test macro
  </li>
</ul>

<h3 id="2.urgent">Why the Urgency?</h3>
<p>
The currently published TS Library Fundamentals 2 is based on C++14, and will
soon be close to a decade out of date with respect to the standard it is based
on.  Many features of that TS are now adopted into the base standard itself,
and the words we use to describe library features changed significantly in
C++20.
</p>
<p>
The current working draft for TS Library Fundamentals 3 has been rebased
(twice) and is currently drafted relative to C++20.  It is correctly worded in
the current form, and has removed all features that have landed in the C++17
and C++20 standards.  It is a much more stable document to maintain.
</p>
<p>
If we send the TS to ballot at the Kona meeting, and get a good turnaround on
the timetable, our following meeting could be ballot resolution.  If we can
turn that around in a single meeting, then the protocol is that there are no
further ISO ballots, and we can proceed straight to publishing.  Meanwhile, we
expect both the Kona meeting and the following meeting to also be ballot
resolution meetings for the base C++23 standard itself.  The net effect, if we
keep to our planned timetable, as that C++23 would go off for final DIS ballot
while the TS Library Fundamentals 3 proceeds straight to publication, still
based on the current standard, C++20.
</p>
<p>
If we do not immediately ballot the TS as-is, we will inevitably face more work
to rebase the TS (a third time) onto C++23, and with the current workload
scheduled for the Library Working Group, that is an exercise we would prefer to
avoid, even though the relative changes are expected to be minor.
</p>

<h3 id="2.precedent">Do We Have Precedent?</h3>
<p>
For reference, here is how the TS Library Fundamentals v2 went through ISO
balloting, concurrently with C++17.  Remember, that TS was based on C++14, so
also had to publish before the new base standard:
</p>
<pre>
  LFTS PDTS ballot                     October   2015, Kona
  C++17 CD ballot,                     June      2016, Oulu
  LFTS Ballot resolution and publish   November  2016, Issaquah
  C++17 DIS ballot                     February  2017, Kona
  C++17 Published                      November  2017
</pre>

<p>
Here is the corresponding timetable we propose for TS Library Fundamentals v3:
</p>
<pre>
  C++23 CD ballot,                     July      2022, Telecon
  LFTS DTS ballot                      November  2022, Kona
  LFTS Ballot resolution and publish   Spring    2023, TBD
  C++23 DIS ballot to publish          Spring    2023, TBD
  C++23 Published                      November? 2023
</pre>
<p>
Note that our Convener informs me that PDTS is no longer a thing, and the
actual ballot would be a DTS ballot, as reflected in the timetable above.
</p>
<p>
Observe that the order of the initial CD ballot for the base standard and the
(P)DTS ballot have been reversed.  This timetable relies on the convener being
able to complete the PDTS ballot before the 2023 Spring meeting, which is
tight.  Finally, if all goes well, the PDTS and C++23 complete ballot
resolution at the same meeting.  The key difference is that the DTS can proceed
direct to publication, while C++20 remains the current standard, while C++23
must pass another round of balloting for the DIS.  If any of these deadlines
slip, we will most likely have to rebase onto C++23, likely delaying
publication by a year or more.
</p>

<h3 id="2.lost">What Do We Risk Losing?</h3>
<p>
Nothing!  Releasing now, rather than waiting to accumulate more features and
changes, essentially costs nothing as there are no expected features and
changes that we are waiting for.  The paper queue is empty, and the draft is
fully updated for the current C++ standard.
</p>
<p>
TS Library Fundamentals 3 would be a smaller release than the previous two
editions of the TS, but that is in keeping with a change in Library Evolution
Working Group practice, now that we are on a regular 3 year release cycle,
which is to more eagerly send features to the base standard itself.  The
Library Working Group is already oversupplied with papers to consider for the
base standard, so further TS work would be relegated to such an extent that we
would be ready to release TS Library Fundamentals v4 by the time further work
completed, assuming that we send TS Library Fundamentals v3 to ballot at the
next meeting.
</p>


<h2 id="4.0">Other Directions</h2>
<p>
Several other approaches were considered and rejected by the authors.  Here we
record those ideas and the reasoning by which they were set aside.
</p>

<h3 id="4.rebasec++23">Rebase Onto C++23</h3>
<p>
Rather than race the C++23 standard into print, we could simply wait for it to
ship, rebase the current TS draft onto C++23, and then go to ballot in 2024
once the revised standard is published.
</p>
<p>
This direction has a lot to commend it, as the end result will be stable and
meaningful for longer.  The downside is that this involves further LWG work to
review the rebase for correctness, and leaves the whole project hanging around
for another 12-18 months with no actual progress expected.
</p>
<p>
We reject this direction mostly for the desire to efficiently complete the
outstanding work and then retire the project, reducing the task list hanging
over the Library Working Group.
</p>

<h3 id="4.mergec++23">Merge into C++23</h3>
<p>
It is simply way too late in the process to consider adding new material to
C++23, so this idea fails on the timetable, before even considering its merits.
</p>

<h3 id="4.mergec++26">Merge into C++26</h3>
<p>
We might instead skip publishing the TS v3, and directly merge the material
into the working draft for C++26 when it opens.  This remains a possibility
even if we do publish the TS promptly though, and discounts the work necessary
to review the features for adoption into the base standard.  There are reasons
that these features are currently held in a TS, and were not immediately
adopted by earlier standards, even if the choice of TS vs Standard might be
different if presented anew today.  Some of these features have been evaluated
for integration previously, and deemed to need more work, such as the stream
joiners.  Meanwhile, the published TS v2 gets more and more out of date as the
base standard continues to evolve.
</p>
<p>
We reject this direction only in the sense that we reject it is a good reason
to defer publishing the current draft as the new TS.  We expect part of the
Library Evolution process for C++26 will be to review and incorporate the
contents of this TS, as appropriate.
</p>

<h3 id="4.abandon">Drop the TS Entirely</h3>
<p>
Another idea is that with the LWG backlog of proposals for the base standard,
and the standard shipping on a 3 year cadence, there is no time for
experimental work such as a TS.  As such, we should simply abandon the project.
</p>
<p>
This suggestion is rejected by the authors, as we have already registered a
work item with ISO and are official in stage 20.00, Preparatory: New project
registered in TC/SC work programme, and it would be embarrassing for future
requests if we abandon this project uncompleted, like the Arrays TS.  Further,
the existing work and time invested in the current TS draft is ready to ballot,
and it would be a shame to lose our sunk cost.
</p>
<p>
However, it is recognised that this will likely be the last such TS for the
foreseeable future, and we should acknowledge that.
</p>


<h2 id="5.0">Proposed Motion</h2>
<p>
The following is based on the motion for TS Library Fundamentals 2 at the 2015
Kona meeting, reworded as we have already created a New Work Item and approved
the working paper at 2018 Jacksonville meeting.
</p>

<blockquote class="proposed_wording">
Move to direct the Convener to appoint an editing committee composed of
  <i>reviewer 1</i>,
  <i>reviewer 2</i>, and
  <i>reviewer 3</i>
to approve the correctness of the working paper
<a href="https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/n4920">N4920</a>
as amended by the straw polls approved at this meeting, and to direct the
Convener to transmit the approved updated working paper for DTS ballot.
</blockquote>


<h2 id="6.0">Acknowledgements</h2>
<p>
Thanks to all the LEWG and LWG participants who have kept this work alive over
the last 6 years, and special thanks to Thomas Köppe for his proactive work as
the project editor, the main reason we are in such good shape that we can
confidently propose going to ballot on barely a meeting's notice!
</p>


<h2 id="7.0">References</h2>
<ul>
  <li>
<a href="https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/n4908">N4908</a>
Working Draft, C++ Extensions for Library Fundamentals, Version 3,
Thomas Köppe
  </li>
  <li>
<a href="https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p2081r1">P2081R1</a>
Rebase the Library Fundamentals v3 TS on C++20,
Thomas Köppe
  </li>
  <li>
<a href="https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0996r1">P0996R1</a>
Rebase Library Fundamentals TS on C++17,
Alisdair Meredith
  </li>
  <li>
<a href="https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p1210r0">P1210R0</a>
Completing the Rebase of Library Fundamentals, Version 3, Working Draft,
Barry Hedquist
  </li>
  <li>
<a href="https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p0052r10">P0052R10</a>
Generic Scope Guard and RAII Wrapper for the Standard Library,
Peter Sommerlad, Andrew L. Sandoval
  </li>
</ul>

</body>
</html>
