Live data from Hacker News

C++26 Reflections adventures and compile-time UML

reachablecode.com

91–100 of 118 posts

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

#91

Earlier quoted context omitted.

[flagged]

You sound like you subscribe to "Orthodox C++". Speaking seriously, I agree there's definitely a lot of bloat in the new C++ standards. E.g. I'm not a fan of the C++26 linalg stuff. But most performance-focused trading firms still use the latest standard with the latest compiler. Just a small example of new C++ features that are used every day in those firms: Smart pointers (C++11), Constexpr and consteval (all impro…

> I'm not a fan of the C++26 linalg stuff.

I don't agree at all. For most, linear algebra is the primary reason they pick up C++. Up until now, the best option C++ newbies had was to go through arcane processes to onboard a high performance BLAS implementation which then requires even more arcane steps such as tuning.

With C++26, anyone can simply jump into implementing algorithms.

If anything, BLAS support was conspicuously missing from C++ (and also C).

This blend of comments is more perplexing given that a frequent criticism of C++ is its spartan standard lib, and how the selling point of some commercial software projects such as Matlab is that, unlike C++, linear algebra work is trivial.

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

#92
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…

You have to rethink your view and understanding of UML - https://en.wikipedia.org/wiki/Unified_Modeling_Language It is not just drawing boxes but a visual modeling language providing both static/structural and dynamic/behavioural views of a complete system. You will only understand its value when you actually deal with large systems consisting of many interconnected modules with dependencies. In such large codebases…

[dead]

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

#93
post #78

Earlier quoted context omitted.

What is this culture of judging everything by amount of money. No one needs a billion dollars, it is practically irrelevant unless you are running on greed

money is a proxy for value. the post i was responding to seemed to be pointing out how little value there is in something else.

The post you responded to said they were very happy about their tools becoming better and your reply read as a dismissal of that, citing someone having made billions by writing an advertisement platform in Python.

So either I and others misread you or it is just a matter of different views on value.

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

#94

Earlier quoted context omitted.

You have to rethink your view and understanding of UML - https://en.wikipedia.org/wiki/Unified_Modeling_Language It is not just drawing boxes but a visual modeling language providing both static/structural and dynamic/behavioural views of a complete system. You will only understand its value when you actually deal with large systems consisting of many interconnected modules with dependencies. In such large codebases…

In wider practice, UML (class diagrams) is never used by working software developers as a frontend to formal methods. It got pushed on everyone, so there could be a layer of "software architects" who didn't have to know how to code and could have endless meetings where the final product was a Bayeux Tapestry of UML. UML captures inheritance and composition well, but a program is more than the sum of its schema. Also,…

It is the complete modeling language (class diagram is just one artifact) that people are looking at using with Formal Methods along with regular Software Engineering. For example Sequence Diagrams are extremely useful in understanding the dynamic nature of a System. Lots of papers have been published, IEEE workshops and there is even an attempt at integrating the B Method with UML to give a UML-B variant. Like any language it is up to the developer to study it and learn to use it productively in his work. Of course it is not the "in thing" but quite useful nonetheless when used appropriately.

Automatic Formal Model Generation from UML Diagrams – An Implementation Experience - https://ieeexplore.ieee.org/document/9753518

UML-B: Formal modelling and design aided by UML - pdf at https://citeseerx.ist.psu.edu/document?repid=rep1&type=pdf&d...

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

#95
post #85

Earlier quoted context omitted.

> It is rare to read something more moronic than that It's not actually wrong though is it - real codebases have been implementing reflection and introspection through macro magic etc. for decades at this point. I guess it's cool they want to fix it in the language, but as always, the approach is to make the language even more complex than it already is - e.g. two new operators (!) in the linked article

> been implementing reflection and introspection through macro magic etc. for decades at this point. Having a flaky pile of junk as an alternative is never been an excuse to not fix the problem properly. Every proper modern language (Rust, Kotlin, Zig, Swift, even freaking Golang) has a form of runtime reflection or static introspection. Only C++ does not. It was done historically with a mess of macros or a pre-compi…

> Having a flaky pile of junk as an alternative is never been an excuse to not fix the problem properly.

Thank you. Some people use the phrases "real projects" and "production code" as if they imply some standard of high quality.

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

#96

Earlier quoted context omitted.

You sound like you subscribe to "Orthodox C++". Speaking seriously, I agree there's definitely a lot of bloat in the new C++ standards. E.g. I'm not a fan of the C++26 linalg stuff. But most performance-focused trading firms still use the latest standard with the latest compiler. Just a small example of new C++ features that are used every day in those firms: Smart pointers (C++11), Constexpr and consteval (all impro…

> I'm not a fan of the C++26 linalg stuff. I don't agree at all. For most, linear algebra is the primary reason they pick up C++. Up until now, the best option C++ newbies had was to go through arcane processes to onboard a high performance BLAS implementation which then requires even more arcane steps such as tuning. With C++26, anyone can simply jump into implementing algorithms. If anything, BLAS support was consp…

Except the devil is in the details as usual, the way linalg is specified doesn't guarantee numeric stability across library implementations or compilers.

Just like the std::random mess, most people are in for a surprise when they attempt to write portable numeric code with it.

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

#97
post #17

Earlier quoted context omitted.

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

> sure, but instagram was created by a handful of people with python and got a billion dollar exit in 2012. Facebook famously felt compelled to hire eminent C++ experts to help them migrate away from their PHP backend. I still recall reading posts on the Instagram Engineering blog on how and where they used C++.

And then HipHop failed to provide as much gains as they hoped for versus the Hack JIT implementation, thus Facebook keeps writing mostly PHP like code in many of their workloads.

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

#98

Earlier quoted context omitted.

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…

C++11 was for me the first version of C++ where the expressiveness justified the extra complexity relative to C. It was when I finally committed to using C++ instead of C for systems code. In the same sense, C++20 is qualitatively better than C++11 in every way and dramatically reduces the complexity of C++11 while adding many features C++11 needed.

I would add C++23, but only due to std being available as modules, and at least on VC++ is kind of ok for side projects.

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

#99
post #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.

You can do static reflection in Java with compiler plugins.

These are the kind of features many folks skip over, as they are niche and require a bit of boilerplate.

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

#100

Earlier quoted context omitted.

The stream of modern C++ features have been a god-send for anyone that cares about high-performance, high-reliability software. Maybe that doesn’t apply to your use case but C++ is widely used in critical data infrastructure. For anyone that does care about things like performance and reliability, the changes to modern C++ have largely been obvious and immediately useful improvements. Almost all C++ projects I know i…

I still have to learn C++20 concepts and now we have a full-fledged reflection system? Good, but I think what happens is there are people on the bleeding edge of C++, usually writing libraries that ship with new code. Each new feature is a godsend for them -- it's the reason why the features are proposed in the first place. It allows you to write libraries more simply, more generally, more safely, and more efficientl…

>The rest of us are dealing with old code that is a hodgepodge of older standards and toolchains, that has to run in multiple environments, mostly old ones. It's like yeah, this C++26 feature will come in handy for me someday, but if that day comes then it will be in 2036, and I might not be writing C++ by then.

Things seem to be catching up. I had the same view up until recently, but now I'm able to use most of the C++23 features in an embedded platform (granted, some are still missing (limited to GCC 11.2).

Post reply on HN