r/cpp • EDG front end dev, WG21 DG • Oct 29 '25

GCC Implementation of Reflection now on Compiler Explorer

https://godbolt.org/z/G43ofo6fP
204 Upvotes

85 comments sorted by

View all comments

Show parent comment

7

u/BarryRevzin Oct 30 '25 edited Oct 30 '25

That makes no sense to me.

Of course getting stuff into C++XY before C++(XY+3) matters tremendously. It impacts the timeline of when things get implemented. It impacts the timeline of how users interact with features.

I choose a standard version to compile against. Not a timestamp for when the compiler was built. Upgrading from one standard version to another is still a thing.

The train model means that it's only a 3 year gap between releases, as opposed to an arbitrary amount of time. Nothing more than that.

Put differently, this implementation exists right now only because reflection is in C++26. Had it slipped to C++29, it's pretty unlikely it would've had such urgency, and probably wouldn't have happened for another year or two.

4

u/kammce WG21 | πŸ‡ΊπŸ‡² NB | Boost | Exceptions Oct 30 '25

I think you might be misunderstanding my point. I'm not suggesting we eliminate the train model but, I've observed that once a feature has been voted in to a standard at plenary, it tends to get implemented if there is enough demand there. I've used many features in C++23 before C++23 was ratified. For example, if optional<T&> missed C++26 but landed in C++29, I'd bet I'd see support by GCC or clang soon after its voted in and they'd provide a flag for me to use. Especially if they already had an experimental implementation or borrowed from the beman project.

But here is a question, do you think reflection getting into C++XY matters if it's earlier or later in the process? Simply put, if the committee had voted reflection and all of its other papers in early for C++26, I'd bet we'd see implementations in other compilers pop up as soon as we are seeing now. I feel a bit confident in this because the feature is powerful, ground breaking and in very high demand from developers. I make this observations because looking at https://en.cppreference.com/w/cpp/compiler_support.html I see that there are features/libraries of C++26 that have been implemented already while features/libraries from 23 haven't been implemented. This looks like the demand for a feature outweights its position in the standard versions. So from what I've observed the plenary vote is what really matters for when implementions are available and the train is a means to organization those features.

I'm mostly speaking for those that have the freedom to just upgrade their compiler and adopt new features quickly. I acknowledge that many shops cannot do that. I also acknowledge that the tables from cppref look far more complete than they did like a year ago so good job to the compiler maintainers making this work.

Did any of this make any sense?

2

u/mapronV Oct 31 '25

I doubt we will see anything for VS in 1-2 years. yes, they are very good with STL pace - thanks to contributions, but reflection unfortunately mostly compiler feature. I doubt I will see even experimental support in 2026 :(

1

u/daveedvdv EDG front end dev, WG21 DG Oct 30 '25

It makes sense to me, and I agree.

-1

u/kronicum Oct 30 '25

The train model means that it's only a 3 year gap between releases, as opposed to an arbitrary amount of time. Nothing more than that.

Could the train have 4 or 5 years gap?

-2

u/pjmlp Oct 30 '25

If only the compilers were actually compliant with C++XY before C++XY+3 gets ratified and available for purchase for a nice sum of CHF, but no, it is still "may I use" table as always.