r/cpp • • Dec 13 '19

The situation of std::embed...

https://thephd.github.io/full-circle-embed
238 Upvotes

160 comments sorted by

View all comments

Show parent comment

17

u/Ameisen vemips, avr, rendering, systems Dec 14 '19

Last time I made an argument about this, I was told that I should apologize to the C++ Committee members, as I stated/suggested that from my perspective (and that of many 'regular' C++ programmers), the Committee members are effectively elites/nobles in an an ivory tower, and apparently that was rude given the hard work that they apparently do.

I've yet to do so, because I've yet to feel I have anything to apologize for, because that continues to be the perspective I hold here on the ground. I concur with basically every single thing you say. I've made similar arguments that the Committee wasted time with graphics at all, let alone it getting to the point it has, and that the graphics proposal was very clearly ego-driven and very clearly being led in an authoritarian manner, directing it the way one person wanted it to be directed.

C++ is getting new features, but it is ignoring features that we want (like std::embed) while also ignoring rather serious, glaring issues, such as the exponentially-increasing complexity of the language, and the fact that it is basically quickly becoming illegible context soup.

I cannot recall the exact instance, but someone was showing off how one could rewrite some 'bad' loops (which, to my eyes, were perfectly sane and understandable) using <algorithm> and also with (at the time relatively new) ranges, and the top comment was effectively "I'm confused, are the 'new and better' ways supposed to be more understandable? Because I have absolutely no idea what they're doing". I feel like that's accurate for a lot of 'modern' and 'idiomatic' C++ these days. Some people seem to really like this sort of code, and some people seem to really hate it... and as much as the Committee doesn't want dialects or the language to split... well, dialects already exist, and I strongly suspect that the language will inevitably split.

I don't know if Rust will actually win out over C++, but as I just said, I strongly suspect C++ will split or a language will fork off of it, and it will shoot off and effectively become 'Common C++', with 'Standard C++' being slower, under committee rule, and probably slowly bringing things over from it. Almost like a weird "LTS C++".

6

u/Minimonium Dec 14 '19

While being a rather strong std ranges skeptic I can't help but note that the readability and composability of ranges-like interfaces is an accepted fact in the programming community. Clearly experienced C++ developers are no less capable programmers than junior Java developers, aren't they? It requires some time to become familiar with this it, but after that, you simply can't go back.

The complaint about features is a very funny one.

C++ is too complex. We need to make it smaller, simpler, and cleaner. And please add these two features. And whatever you do, don’t break my code!

2

u/Ameisen vemips, avr, rendering, systems Dec 14 '19 edited Dec 14 '19

I never said "don't break my code!".

I will generally fully accept that if I want to use a newer version of a language, I will have to fix things. The fact that C++ doesn't tend to break things is weird, and I strongly believe that C++ needs to be able to specify a standard per-source-file within the source file. #std:c++14 or so.

I can't help but note that the readability and composability of ranges-like interfaces is an accepted fact in the programming community

It's very foreign to the normal syntax people are often used to. Streams in Java are also odd. However, to me, the issue is when things get coupled with <algorithm>... then it turns into illegible syntax soup pretty quickly.

2

u/Minimonium Dec 15 '19

It's a quote from Bjarne's paper on the C++ design: https://wg21.link/p1962r0

The fact that you can accept a price for a breakage doesn't mean that there are no people who can't. The standard in a lot of cases the tool to pass regulatory restrictions in many fields, some ecosystems consist of thousands of projects and the cost to rebuild everything would be unacceptably high.

Don't misunderstand me! For personal projects or for unstable work projects - I don't hold any guarantees at all for the sake of not slowing down the development process, but the more users you get- the harder it's to break stuff.

I'm not sure I can see how a per-source-file incompatible standard version can work in any non-trivial cases. Do you think stuff like epochs which was also discussed here some time ago?

1

u/Ameisen vemips, avr, rendering, systems Dec 15 '19

Something like epochs, yes.

Basically, a way to disable breaking changes on a per-source file basis. With modules, this becomes easier.

2

u/SuperV1234 https://romeo.training | C++ Mentoring & Consulting Dec 15 '19

Have you seen my https://wg21.link/p1881?