logoalt Hacker News

Mirror_bridge – C++ reflection for generating Python/JS/Lua bindings

13 pointsby fthiesentoday at 5:47 AM2 commentsview on HN

Comments

dsp_persontoday at 8:09 AM

Cool to see C++ reflection getting somewhere.

> The Docker image includes clang-p2996, Bloomberg’s experimental Clang fork that implements the reflection proposal. As P2996 moves toward standardization, expect this to land in mainline compilers.

Possible to use that C++26 compiler just to do code generation for the binding code, and then use any other compiler for your actual build? I suppose alternatively could use a parser. Is the reflection code easy to work with in comparison? A year or two ago I spent some hours pulling my hair out trying to do some reflection in C++ until I gave up and spent the 20mins needed to write a python script to read my source files and do the code generation I needed.

a_t48today at 7:05 AM

I feel a little bit nerd sniped - halfway through the article I wanted to cry out "but the loop!" and then they moved the loop. Nice job, I'm super excited to use this in my own code. I have a bunch of handwritten metadata about C++ classes that I'd rather ditch and use something that the language provides.