SD-9: Library Evolution Policies

Doc. No.: SD-9
Date: 2024-05-14
Reply to: Inbal Levi

What are Standard Library Policies

A "policy" is any technical rule or technical guideline, which should be followed by authors of proposals of utilities for the C++ standard library.

Policies are set by Library Evolution Work Group (under JCT1/SC22/WG21), using the process described in P2267R1.

The following document describes the existing C++ Standard Library Policies. Please read it carefully before writing a proposal to LEWG.

As a rule, your paper should apply all the policies. The section "Excluding a proposal from applying a policy" describes the process that should be followed for any policy to be bypassed.

Motivation for Standard Library Policies

Pros for setting policies

1.  Policies create uniformity in users' expectations from the behaviour of different parts of the standard library

2.  Policies save time for both authors and the committee

3.  Policies need to be created from a shared knowledge base

4.  Policies make the standardization process friendly for newcomers

Cons for setting policies

1.  Policies may "push aside" domains which are in a minority representation in the committee

2.  Policies may enforce wrong technical solution for some utilities proposed for the standard library

Excluding a proposal from applying a policy

To address the concerns brought up above, a paper can avoid applying a policy, as long as it contains detailed technical rationale and justifications.

Prior art in the field discussed can also help with providing reasoning, but it's the authors' responsibility to explain why the policy can't be successfully applied to the utility proposed into the standard library.

List of Standard Library Policies

1. Policy: Library wording should not use [[nodiscard]] (P3201R1: LEWG [[nodiscard]] policy (Jonathan Wakely, David Sankel, Darius Neațu))

Rationale: Warnings are non-normative so [[nodiscard]] placement has a spurious impact. Furthermore, implementors are better qualified to identify when and where to emit warnings for their implementations.

References

  • P3162R0: LEWG [[nodiscard]] policy (Darius Neațu, David Sankel)
  • P3122R1: Using [[nodiscard]] should be Recommended Practice (Jonathan Wakely)