Date: Thu, 21 Dec 2023 15:23:03 +0100
Here are the links to the relevant papers:
The Lakos Rule:
Functions with narrow contracts (like [] for std::vector demanding a valid id) should *not* be noexcept, even if they do not throw for valid input.
It came into renewed view, as contracts come to light for C++26.
Against
2020-09-23 https://github.com/cplusplus/papers/issues/929 = P2148 - Library Evolution Design Guidelines (CJ Johnson, Bryce Adelstein Lelbach)
2019-06-10 https://github.com/cplusplus/papers/issues/439 = P1656 - "Throws: Nothing" should be noexcept (Agustín Bergé)
In Favour of
2023-10-13 https://github.com/cplusplus/papers/issues/1654 = P2979 - The Need for Design Policies in WG21 (Alisdair Meredith, Harold Bott, John Lakos)
2023-09-13 https://github.com/cplusplus/papers/issues/1634 = P2755 - A Bold Plan for a Complete Contracts Facility (Joshua Berne, Jake Fevold, John Lakos)
2023-07-14 https://github.com/cplusplus/papers/issues/1590 = P2949 - Slides for P2861R0: Narrow Contracts and noexcept are Inherently Incompatable (John Lakos)
2023-05-15 to 2023-06-08 https://github.com/cplusplus/papers/issues/1544 = P2834 - Semantic Stability Across Contract-Checking Build Modes (Joshua Berne, John Lakos)
2023-05-18 https://github.com/cplusplus/papers/issues/1520 = P2861 - The Lakos Rule: Narrow Contracts And noexcept Are Inherently Incompatible (John Lakos)
2023-05-15 https://github.com/cplusplus/papers/issues/1514 = P2831 - Functions having a narrow contract should not be noexcept (Timur Doumler)
2023-05-10 https://github.com/cplusplus/papers/issues/1515 = P2837 - Planning to Revisit the Lakos Rule (Alisdair Meredith)
2019-02-13 https://github.com/cplusplus/papers/issues/550 = P1487 - User Experience with Contracts That Work (John Lakos)
-----Ursprüngliche Nachricht-----
Von:Frederick Virchanza Gotham via Std-Proposals <std-proposals_at_[hidden]>
Gesendet:Do 21.12.2023 13:39
Betreff:[std-proposals] Lakos rule
An:std-proposals <std-proposals_at_[hidden]>;
CC:Frederick Virchanza Gotham <cauldwell.thomas_at_[hidden]>;
I see people arguing that the Lakos rule should be kept, and others saying it should be abolished.
For everyone to meet half way, what if the Standard library could do:
namespace std {
int SomeFunc(int,int) noexcept_Lakos;
}
A function marked as 'noexcept_Lakos' is said to be a 'Lakos function'.
So then if you want a Lakos function to be 'noexcept', you do something like:
void MyFunc(int const a, int const b) noexcept
{
using noexcept_Lakos;
// The above line ensures that all
// Lakos functions called in this
// function won't throw
return 2 * std::SomeFunc(a,b);
}
Or if you just want to single-out one function call:
void MyFunc(int const a, int const b) noexcept
{
return 2 * _Lakos(std::SomeFunc(a,b));
}
--
Std-Proposals mailing list
Std-Proposals_at_[hidden]
https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
Received on 2023-12-21 14:23:05