points by muvlon 4 days ago | 0 comments
A 3-year cycle is not the problem, the pace of new features is. C++14 vs. C++11 for example was a totally reasonable upgrade and well-paced. C++26 vs. C++23 is a huge change by comparison. Everyone has their own opinion about which fancy complicated language feature will finally "fix" C++ (concepts? contracts? reflection? profiles? constexpr?) and the answer of WG21 has been to just put all of them into the already full kitchen sink.
You can fix every problem in language design with more language features, except "too many language features". Most people on the committee even seem to intellectually understand this, but their preferred time to stop adding new major features is "once my pet feature is in".
And to harp on the safety thing a bit: In the absence of an actually safe subset of C++, additional language complexity is also a safety problem. "best effort" safety like the stuff C++ is pursuing at the moment still relies on you knowing exactly what your code does, which is hindered by complexity.
Here's an example for contracts. Say you have the following declaration:
void foo(int* p)
pre (p != nullptr)
pre (*p >= 0);
What happens if you pass a nullptr? You'd guess that it either raises a contract violation or silently ignores it, right? Yes, those are two possibilities, in the "enforce" and "ignore" modes respectively. But there's also an "observe" mode, where the preconditions are checked at runtime and violations reported but then execution resumes normally. Can you see the problem? Passing a nullptr causes evaluation of the second precondition to deref it, so we get UB from the contracts themselves before we ever hit the function body (which might have its own, classic nullptr checks, who knows). This is a completely new class of footgun that you never had with assertions (they are always either enforced or ignored).
[–] leni536 4 days ago