News for hackers. Stuff that matters.
Re:C++26 Disapproved by forrestthewoods on Wednesday November 04, 2026 @12:40AM (#50361847)
No. The problem isn’t that std::regex is slow and badly designed. It’s that std::regex exists at all.

C++ is unique in that it defines a spec for STL but not implementation. The result is something that is both overspecified and underspecified.

Including batteries is fine. Including a spec for what the batteries should look like is such a profoundly bad idea that no other major language does it.

Re:C++26 Disapproved by ameliaquining on Wednesday November 04, 2026 @01:15AM (#50362010)
I'm confused about what exactly you're arguing for. Is the idea that the standard library should be minimal and then each compiler should ship its own nonstandard "batteries" library?
Re:C++26 Disapproved by forrestthewoods on Wednesday November 04, 2026 @01:38AM (#50362146)
I think the language committee should provide a spec where required (OS filesystem, mutex, etc). And when it is not required they should simply provide a plain bog standard library.

There is absolutely no reason for std::deque to be a specification. The committee should either ship a committee library for std::deque or they should leave it to the community. They can provide a battery or they can not. Providing a spec for a battery that is both over and under specified is the absolute worst possible choice.

Re:C++26 Disapproved by ameliaquining on Wednesday November 04, 2026 @02:49AM (#50362530)
Do you also think the committee should ship a compiler? If not, what's the difference?
Re:C++26 Disapproved by tancop on Wednesday November 04, 2026 @03:13AM (#50362673)
Compilers are complex, platform specific and the architectures behind them can be wildly different. Maintaining a reference compiler would be a lot of work for no real benefit.

The standard library on the other hand is a library. It's almost always implemented as plain C++ without much platform specific code. ISO could take an existing free licensed implementation and declare it as the standard. Of course anyone is free to make their own competing one, it just has to always match the official library's behavior.

Writing a spec instead of code is just creating duplicate work and compatibility issues any time the spec is unclear.

Re:C++26 Disapproved by forrestthewoods on Wednesday November 04, 2026 @03:50AM (#50362921)
The difference is that I can trivially write a std::deque container that runs under any compiler that implements the C++ spec.

Why on earth would I want a different implementation of std::deque on each platform I use because the compiler team needed to provide one? It’s madness!

Re:C++26 Disapproved by imtringued on Wednesday November 04, 2026 @07:00AM (#50364392)
The standard library would just be C++ code that a compiler turns into machine code.

I remember a language where the core language types, including primitives and a bunch of keywords, were actually defined in the standard library and the compiler just special cased support for the types in the standard library for optimization purposes.

Your loaded question feels very silly from that perspective.

Re:C++26 Disapproved by klempner on Wednesday November 04, 2026 @08:40AM (#50365366)
I think this is misunderstanding the problem with std::regex -- the problem isn't so much that it provides a "spec for what the batteries should look like" but rather that it is naturally ABI entangled and so the bad first generation implementations are unfixable given that the committee refused to allow for an ABI break to fix this.

The real problem is the latter: C++ has always had a "you don't pay for what you don't use" as part of its core philosophy but it turns out that doesn't apply if the thing you don't use is ABI stability.

(and, failing an ABI break story, std::regex should have had an implementation that was more PIMPL and less template so it would have fewer ABI issues, possibly followed by a regex2 later that could get more of the compile time bits once implementations were more mature.)

Re:C++26 Disapproved by forrestthewoods on Wednesday November 04, 2026 @05:35PM (#50372443)
I think both are problematic.

I think even if C++ had a periodic ABI break that even a better std::regex spec is fundamentally wrong.

As someone who ships cross-platform I never ever want different platforms to have different implementations for things that are not actually platform specific. Having different implementations of std::string depending on if I’m on windows, Linux, Mac, iOS, Android, PlayStation, Xbox, or Nintendo is a profoundly terrible thing to do.

Re:C++26 Disapproved by dizzant on Wednesday November 04, 2026 @10:21AM (#50366866)
I'm sorry you don't like std::regex. That isn't a problem with C++'s specification practice.

C++'s separation of spec from implementation is clearly functional. There are several major open-source standard library implementations that compete on the basis of performance, ABI stability over versions, quality, etc.

C++'s core ethos is "only pay for what you use". std::regex does this. In my experience, the "problem" with std::regex is that it provides more features by default than most people want, and you pay for using those features. Specifically, std::regex respects the runtime locale. There are good reasons a standard library feature might do this (e.g. it simplifies the interface, it's broadly applicable, etc.), but it's obviously not going to give optimal performance. This is a necessary tradeoff for any standard library.

Locale handling requires dynamic memory allocation, virtual function dispatch, sometimes system calls. Locale handling also prevents some low-level optimizations based on the character encoding. If you need that kind of performance, std::regex probably isn't for you, go grab a non-standard library that suits your needs.

Re:C++26 Disapproved by forrestthewoods on Wednesday November 04, 2026 @12:23PM (#50368687)
locale is a great example of a concept that is catastrophically bad, provides zero value, and shouldn’t exist at all in the spec.

std::regex is so worthless that no one uses it. My codebase gives CI warnings when it’s used. so it’s not even really a problem. It is indicative of a larger problems.

> C++'s separation of spec from implementation is clearly functional.

Your bar of “clearly functional” is is not a compelling or meaningful bar. What a weird fallacy.

C++11 was pretty great and meaningfully modernized the language. The amount of useful good things in each following release got smaller and smaller. Maybe just one or two useful improvements in C++20. Almost nothing in C++23. And now C++26 has failed to pass. It’s grinding to a halt. The biggest recent features such as concepts and modules have been catastrophic failures.

Those failures aren’t all due to my specific complaint of “battery specs are a bad idea”. But “functional” is the lowest possible bar. And one could argue that as a whole isn’t being met.

Re:C++26 Disapproved by dizzant on Monday November 09, 2026 @02:06PM (#50430083)
> catastrophically bad, provides zero value, and shouldn’t exist

Again, if you don't like it, don't use it. Can I assume that you would agree that `std::format`, which does not use locales, was a good addition in C++20?

> Your bar of “clearly functional” is is not a compelling or meaningful bar.

I pointed to the existence of multiple widely adopted, successful, competing implementations as evidence that the standard does functionally achieve the explicit goal of standardization, i.e. to support multiple implementations.

> Those failures aren’t all due to my specific complaint of “battery specs are a bad idea”. But “functional” is the lowest possible bar. And one could argue that as a whole isn’t being met.

You recognize that you're moving the goalposts here, right? Your overall point appears to be that the benefit of multiple implementations is not worth the costs of standardization, and that centralizing to a single specific implementation would be better in certain ways. In particular, it seems you think that more features per release ("each following release got smaller and smaller"), different features that what we got ("just one or two useful improvements in C++20"), and less community input about proposed changes ("C++26 has failed to pass") would be better than the status quo.

That's a fine opinion, but it's not an argument that standardization isn't functional.

> concepts and modules have been catastrophic failures

You're right about modules. C++26 failed to pass because some in the community don't want to repeat the mistake with contracts. This is a victory for standardization, not a loss. Further evidence that the process is working: the other improvements in C++26 (like reflection) are so desirable that this delay meaningfully hurts. If nobody wanted the changes, we'd all still be using C++11. And as always, if it's C++11 you want, the existence of the standard makes it possible.