reflection TS - in C++23?
Asked Answered
I

1

24

Reflection TS - C++ feature described here: https://en.cppreference.com/w/cpp/keyword/reflexpr

I am looking for any information about this feature.

I have this table describing compiler support: https://en.cppreference.com/w/cpp/compiler_support

but I don't see that this feature is planned or maybe the name of this feature is different?

In which C++ version will this functionality be supported?

Where can I find any tutorials/ info on this topic?

Impenitent answered 12/8, 2021 at 16:21 Comment(8)
Doesn't look it's published yet SG7, Compile-time pgmg 23619 TS Reflection Publish? from isocpp.org/std/status . It's also not listed as a currently active project.Knossos
"In which C++ version will this functionality be supported?" - Not sure we can tell you when a group of people will vote a certain way.Sabotage
Reflection is not done yet, and it's unclear when it will be. I'd look into alternative solutions, such as macros or using libclang to parse your own code.Submerse
Complex feature like that often take longer than initially expected to be ready. Some people will try to implement it on a compiler and depending on how ready the feature is (probably somewhere in 2022), it will be decided if it is include in C++23 or delayed. Then you have to wait that compiler implement it including any changes between the reference implementation and the final version.Analogical
Some useful resource can be blogs.gnome.org/jamesh/2017/01/17/…Bissonnette
Keep in mind that covid really threw a wrench in WG21 across the board. Don't get your hopes too high that most or all of the stuff thought before covid to be in C++23 will actually be ready. That's just the unfortunate reality of a world-changing event that no one prepared for.Oidium
@Oidium "No one": I mean, much of industrialized SE Asia was prepared for it, having taken the lesson of SARS-1 seriously. You can see that in the initial responses to the outbreak there; they had a system set up for exactly this kind of problem, they executed it, and it worked. Had every nation the same response effectiveness as (for example) SK, Covid 19 would have been another failed pandemic. Instead, millions dead, possibly a billion+ already infected, and it got to evolve into Delta; the evolved versions have started to break the preventative measures of the region.Buccal
@Yakk-AdamNevraumont, Sorry, I really should have made sure I stuck to the topic by limiting that last part to the standardization process. I don't mean to sow doubt or discord over whether most of the world (including my own country) could and should have done better, beginning in advance. To most people, that's not up for debate, and I can assure you those around me have probably gotten tired of hearing about some of those countries (e.g., when there wasn't even any form of testing where I got my doses, only screening questions).Oidium
R
29

While the Reflection TS was officially finished and published, at the same time significant progress was being made developing an alternative syntax that made use of newer language features like consteval to express reflection information as values rather than types (as in traditional template metaprogramming). The TS was published anyway as a record of the design decisions already made and to serve as a point of reference for the new design, but so long as progress continues smoothly on it it’s unlikely that the old version will be implemented anywhere. It’s also unlikely that the new system will be finalized in time for C++23, although experimental implementations of it might become available at about that time.

Rolo answered 13/8, 2021 at 2:35 Comment(6)
Do you have a reference for the alternative syntax using consteval?Gelatin
@ConnorLawson: The current proposal is from about a year ago.Rolo
@ConnorLawson p1240r2Fachini
We gotta wait for c++26 :( medium.com/yandex/…Harriet
@DavisHerring Thank you for your answer. Do you have an update, or a link to the latest proposal? It's hard to find anything definitive online; from talking to an expert a few years ago, it appears that the kind of "simple" reflection use cases that many programmers have could get stuck in a much larger discussion, and I worry that progress will be very difficult.Kolinsky
@TooTone: It seems that Boris’ link is (still) the latest. I think it was deferred when it became clear that it wouldn’t make C++23, but it should get more review soon.Rolo

© 2022 - 2024 — McMap. All rights reserved.