1) Yes, we're using the preprocessor. Best tool c++ has at the moment. 2) Reflection macros are intentionally outside the declaration. I may not want to reflect all members of a struct. I may want to reflect a 3rd party lib's structs.
-
-
Näytä tämä ketju
-
3) It's all known at compile time, so you can even type deduce based on whether a struct has a member by a certain name, type, or offset. 4) Supports structs, enums, dynamic arrays (vectors), and strings. Plans to support variant-likes and associative containers.
Näytä tämä ketju -
5) We intentionally don't support pointers and references. I don't find much value in reflecting them, although it wouldn't be difficult to do so.
Näytä tämä ketju -
6) Despite using the preprocessor, aesthetic was also important to us. BEGIN()/END() macros are ugly. Wanted something sleek, native-feeling. I think we mostly accomplished that.
Näytä tämä ketju -
As an aside, Circle has been showing off attributes recently. I think this system can pretty easily expand into that. As a bonus, we could add attributes to a 3rd party lib's structs. Not sure if circle can support that the way they implement attributes.
Näytä tämä ketju -
This is how I envision attributes being added. Some unknowns yet, but I think it's doable.pic.twitter.com/31PVjVzjNH
Näytä tämä ketju -
Proper reflection, when c++ finally gets it, is going to change so much. I am tweeting about this to point out how far we can get already. It's not as pretty, but still very serviceable.
Näytä tämä ketju -
Oh, forgot to mention! The core reflection header is ~ 500 LOC with comments. It does use a few of our in-house classes and utilities. If it were made standalone, probably 800 LOC with comments.
Näytä tämä ketju
Keskustelun loppu
Uusi keskustelu -
Lataaminen näyttää kestävän hetken.
Twitter saattaa olla ruuhkautunut tai ongelma on muuten hetkellinen. Yritä uudelleen tai käy Twitterin tilasivulla saadaksesi lisätietoja.