← Back to context

Comment by mpyne

4 days ago

I was literally running into something a couple of days ago on my toy C++ project where basic compile-time reflection would have been nice to have for some sanity checking.

And even if it's true that some things can be done already with specific compilers and implementation-specific hacks, it would be really nice to be able to do those things more straightforwardly.

My experience with C++ changes has been that the recent additions to compile-time metaprogramming operations is that they improve compile times rather than make it worse, because you don't have to do things like std::enable_if<> hacks and recursive templates to do things that a simple generic lambda or constexpr conditional will do, which are more difficult for both you and the compiler.

The history of C++ has been one long loop of:

1. So many necessary common practices of C++ are far too complicated!

2. Std committee adds features to make those practices simpler.

3. C++ keeps adding features. It’s too big. They should cut out the old stuff!

4. The std committee points at the decade-long Python 3 fiasco.

5. Repeat.

  • Do they point at python 3? They were committed to backward compatibility long before python3 happened.

    To me it feels like they have fleshed out key paradigms so that is not a mess anymore. They are not there yet with compile time evaluation (constexpr consteval,...), at least with C++20, not sure if it's mostly finished with C++23/26.

    The language itself and std is quite bloated but writing modern C++ isn't that complicated anymore in my experience.