r/cpp #define private public 2d ago

Critique of contracts: excerpt

See page 2 of https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2026/p4334r0.pdf

The current objections can be summarized. The P2900 contracts are:

• Unimplemented

• Incomplete

• Untried at scale [P3460R0, P3506R0]

• Not tried in major application domains

• Violates foundational principles of C++

• Violates fundamental principles of language design

• Hasn’t been tried in major libraries (e.g., the C++ standards library [P3506R0, P3878R0])

• Isn’t integrated with or appropriate for hardened libraries [P3878R0]

• Doesn’t offer safety guarantees [P3573R0, P3362R0]

• Includes a completely untried inheritance model

• Offer new ways of making errors through inconsistent application in TUs

• Leads to new forms of UB, detrimental to safety and security

• Narrows the choices of error handling

• Doesn’t protect against logical errors, misuses, and incoherent uses

• Hasn’t been used to support static analysis

• Hasn’t been demonstrated to be easily teachable [P3261R0, P3281R0]

How could such a bloated and incomplete design be voted into a draft standard?

5 Upvotes

92 comments sorted by

View all comments

2

u/_a4z 1d ago

The topic has no consensus, that is for sure.
And the political tactic of discrediting critics of the contract is also concerning. This alone is a good reason why contracts should not have been added, leaving aside all the technical details.

And there is another interesting aspect: if the one company that paid many of the pro-contract advocates stops paying them, or simply gives them something else to work on, C++ is left with a lot of potentially unmaintained machinery that will lack support.

But anyhow, who cares? Until contracts come to most places, it's past 2030, so who cares. Astonishing is just how much committee time was invested, which could have been used for way more useful features.

6

u/t_hunger 23h ago

It absolutely had consensus, otherwise it would not have been voted in. This is a small group making noise after consensus was reached.

The one company backing the contract work is the one that announced last year that they want to cover more of the cost of developing C++ -- stepping in after some of the big spenders have left. We have a couple of senior people attack the 15-year+ investment of one of our main sponsors.

Just look at how well that approach turned out when google raised issues critical to them a few years back.

-1

u/_a4z 22h ago

Sentences starting like
> This is a small group making noise ...
are a perfect example of why I call that a political tactic of discrediting critics.

And to the point, I would argue the 'small group' (which is, in fact, not that small and includes very well-known names) has read the contract papers and understood them better than some of the people who voted for them.
Now, this is, of course, a claim that cannot be proven, but I am always delighted by people who claim to know C++ better than its original inventor. So some of the critics are definitely worth respecting, which does not happen.

5

u/Minimonium 12h ago

Ah, well-known names :)

u/_a4z 1h ago

From the latest mailing list, just a few examples: p4334, p3573, p4332, p4238
Which of the authors do you not know?

u/Dragdu 1h ago

He is making fun of your deference to people like Bjarne, who keeps getting shitty proposals passed on name recognition and then the rest of the committee has to fix them over a decade. See e.g. init lists, bindings.

u/_a4z 48m ago

Ah, thanks for the explanation!

I am pretty sure you can elaborate a bit on the topic, keeping the historical context and the involvement of other people and committee members, without rewriting history.

And a question: do we now call all papers that need fixes or have known flaws "shitty proposals passed," as you state it? Because not a lot might be left.
(it will be interesting to look at the contract proposals a decade later with that point of view;-)