Live data from Hacker News

C++26 Reflections adventures and compile-time UML

reachablecode.com

31–40 of 118 posts

Re: C++26 Reflections adventures and compile-time UML

#31
post #6

Whenever I start to feel like a real programmer making games and webapps and AI-enhanced ETL pipelines, I inevitably come across the blog post of a C++ expert and reminded that I am basically playing with legos and play-doh.

It's the other way around. You are the real programmer and the committee and the "modern C++" crowd are more interested playing with legos instead of shipping actual software. No way anything std::meta gets into serious production; too flexible in some ways, too inflexible in others, too much unpredictability, too high impact on compilation times - just like always with newer additions to the C++ standard. It takes o…

I bet CERN might eventually replace their Python based code generators with C++26 reflection.

Re: C++26 Reflections adventures and compile-time UML

#32
post #7

Reflection really was the missing piece, it's one of the things that are so nice in Java. Being able to serialize/deserialize a struct to JSON fully dynamically saves a lot of code.

Nb. This is fully static reflection, not runtime like in Java.

Re: C++26 Reflections adventures and compile-time UML

#33
post #8
post #6

Earlier quoted context omitted.

It's the other way around. You are the real programmer and the committee and the "modern C++" crowd are more interested playing with legos instead of shipping actual software. No way anything std::meta gets into serious production; too flexible in some ways, too inflexible in others, too much unpredictability, too high impact on compilation times - just like always with newer additions to the C++ standard. It takes o…

What's the solution that's been around for years? > ... just like always with newer additions to the C++ standard. This is objectively laughable.

For example, boost library's "describe" and similar macro based solutions. Been using this for many years.

Re: C++26 Reflections adventures and compile-time UML

#35
post #17

Earlier quoted context omitted.

I know the trading firm I work at will be making heavy use of reflection the second it lands… we had a literal party when it made it into the standard.

sure, but instagram was created by a handful of people with python and got a billion dollar exit in 2012.

And Youtube used Python almost exclusively at the start AFAIK.

Then again Scott Meyers said he's never written a C++ program professionally.

Re: C++26 Reflections adventures and compile-time UML

#36
post #12
post #8

Earlier quoted context omitted.

What's the solution that's been around for years? > ... just like always with newer additions to the C++ standard. This is objectively laughable.

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 re…

Constexpr if and fold expressions have been a god send!

Re: C++26 Reflections adventures and compile-time UML

#37
post #31
post #6

Earlier quoted context omitted.

It's the other way around. You are the real programmer and the committee and the "modern C++" crowd are more interested playing with legos instead of shipping actual software. No way anything std::meta gets into serious production; too flexible in some ways, too inflexible in others, too much unpredictability, too high impact on compilation times - just like always with newer additions to the C++ standard. It takes o…

I bet CERN might eventually replace their Python based code generators with C++26 reflection.

Which problem would this solve for them?

Re: C++26 Reflections adventures and compile-time UML

#38
post #2

I had to do a UML thing for the first time in years for a class a few weeks ago[2]. I'm not 100% convinced that UML is actually useful at all. Obviously if you find value from it, don't let me take that from you, by all means keep doing it, but all it seemed to provide was boxes pointing to other boxes for stuff that really wasn't unclear from looking directly at the code anyway. It's really not that hard to look dir…

For many of us UML has been completely irrelevant for decades. If you're deep down the OOP rabbit hole, then UML can have it's place in helping you keep track of your hierarchies. If you use it then I'd assume that getting your process of keeping it updated as automated as possible would be a high priority, unless you want it to rod in some ivory tower.

Personally I view architecture in UML, ArchiMate or draw.io rather than being build with something similar icepanel.io to be a complete waste of my time. But that's just me.

Re: C++26 Reflections adventures and compile-time UML

#39
post #6

Whenever I start to feel like a real programmer making games and webapps and AI-enhanced ETL pipelines, I inevitably come across the blog post of a C++ expert and reminded that I am basically playing with legos and play-doh.

It's the other way around. You are the real programmer and the committee and the "modern C++" crowd are more interested playing with legos instead of shipping actual software. No way anything std::meta gets into serious production; too flexible in some ways, too inflexible in others, too much unpredictability, too high impact on compilation times - just like always with newer additions to the C++ standard. It takes o…

Yeah, wait till you find out what's behind the curtain in your web engine and AI.

Hint: it's C++, and yes, it will eventually use stuff like std::meta heavily.

Re: C++26 Reflections adventures and compile-time UML

#40

Earlier quoted context omitted.

I would argue that C++ expertise doesn't necessarily correlate to the complexity of the software being developed. Although I do try to learn the fancy new features I know many developers who even though they are still only using C++11 features they are creating some very complex and impactful pieces of software.

I definitely think that’s not a coincidence. C++11 is where you get the most useful feature tradeoffs with reasonable costs. Smart pointers being a great example. Shared ptr has its issues, it isn’t the most performant choice in most cases, but it by far reduces more footguns than it introduces. Compared to something like std::variant in the C++17 standard that comes with poor enough performance issues that it’s rare…

Just because someone didn't bother to learn anything past C++11 doesn't mean C++11 is some sort of performance sweet spot.
Post reply on HN