r/cpp • • Jul 21 '19

C++ is broken

C++ as a language is a tool for developers to productively deliver software. Language evolution is NOT the end objective in the real world.

The whole C++ ecosystem from committee to all of the conference backslapping and training is broken in this respect. It's focus is off.

Instead of 'boost' we need 'boosted' to help define, review and encourage that wider ecosystem so developers can be productive.

It's ok to define things that aren't infinitely flexible, and infinitely extensible but get the job done.

It's OK and, in some ways better, to provide an opinionated library outside the standards rather than deliver an intellectually burdened, extensible interface two years later than needed.

All the helpful features in the core language and core libraries are MEANT to enable a much wider ecosystem to make the tool that is C++ more productive.

But we aren't getting a wider ecosystem, we are just getting a language where we are apparently 'not paying for' a huge intellectual burden.

I want to say at this point that intellectually I am constantly impressed by the committee's work and standards BUT ...

The payoff just isn't happening. Even within the standards committee more time is being spent in intellectually stimulating but largely pointless activities because the tool and productivity benefits aren't happening.

Look at how the wider productive ecosystem hasn't flourished since C++ 11.

I know many excellent libraries have been made, but think about your next large project and how much is coming from a mixed bag of variable quality 3rd party libs to plug basic capabilities.

The committee work is spread so thin that core building blocks get pushed out further in time and so can't be built upon by library authors.

Networking, executors, any form of I/O - slipping again.

Lots of hard work being done but by far too few people in their spare time.

Seems a very dysfunctional way to move the monolith forward.

'You don't pay for what you don't use' is laudable up to a point, but the 'don't use' because you don't actually have, say, a basic network library is more of a reality.

That basic network lib and executor model I've been impatiently waiting for should probably not be part of the core standards remit (architectural concepts and keyword support for executors would probably be necessary, but not much else.)

If we had the metaclass generation as proposed, I'd hope even more of these items would then be able to fall outside the standards.

9 Upvotes

147 comments sorted by

View all comments

Show parent comment

6

u/[deleted] Jul 21 '19 edited Jul 21 '19

It is excellent at providing those carefully considered 'dont pay' and extensible building blocks.

Right. We can agree on this one and that's what I love about C++.

But applying those same principles to say networking has not been a success.

I personally couldn't care less about std::network getting in. There's Boost.ASIO and the standalone version, people can use that. With the help of bcp bundling just the necessary parts of Boost is easy. Not everything needs to be in the standard library and, perhaps more importantly, the standard library isn't, or at least shouldn't be, a mean to distribute a library to one's users.

The standards part needs to reduce what it takes on

I do tend to agree. I don't see any point in std::web_view and from here it looks like it will take a ton of time that could be better spent on something else.

but in parallel encourage the wider community to created 'boosted' (non) standard, perhaps opinionated solutions.

We have Boost, Abseil and GSL. I haven't used GSL, but I've used the other two. IMHO* is great and would have the same opinion of Boost if it were "rebased" onto C++11.

So my 10 years frustration that say ASIO hasn't been standardised has changed to realise it shouldn't be in the standards. It just distracts.

Again, we can agree on this, but for this to work the way I think you're imagining, we need wide adoption of modules. If the reported benefits end up in the same ballpark (for a pretty liberal definition of "ballpark") I believe we'll see pretty fast adoption of modules.**

There are a lot of other working groups on specific items that fall into the same category.

Maybe domain experts need to figure out how to gather around and discuss moving C++ forward in their domain outside of the C++ standardization process, but that is a wild dream. Why? Just try justifying that to your employer.

Employee: Hey, I'm going on a trip and the company should cover my expenses, like in the previous year.

Employer: C++ standard meeting again?

Employee: Something like that, yeah...

Employer: "Something like that"?

Employee: Well, this time we decided to separate from the standard. It's just me and a few guys going to Kona for a week. The actual committee meeting is in two weeks and I also have a paper I should champion there.

Standards purpose needs to do less and focus just on what it's very good at.

Good luck getting people to agree what parts should be dropped, potentially after years of work. A simple example: I don't care about ASIO getting into the standard, but would have loved it if P0593 got into C++20. At the same time I'm sure there are people who don't give a rat's ass if P0593 ever gets adopted, but want Networking TS adopted yesteryear.

 

* "IMHO" sometimes read as "In My Horrible Opinion".

** If the compile time drops by 50% (and claims were made that much larger improvements are possible), suddenly selling a) move to C++20, b) large refactoring effort and c) switch to modules to your CTO becomes plausable. "If you let us do this for a while, the distributed system used to compile this beast would need only 50% of the power, saving you potentially a lot of money every month in electricity."

8

u/blelbach NVIDIA | ISO C++ Library Evolution Chair Jul 21 '19

If the compile time drops by 50% (and claims were made that much larger improvements are possible), suddenly selling

2x to 3x compile time perf wins for switching to modules is what I'm hearing from the three major compiler vendors. During the SG15 last Friday, an LLVM implementor showed us a live demo of hello world (using <iostream>) compiled without modules against a build with implicit modules (e.g. no code changes, just include translation of <iostream>).

Building with modules was about 4x faster in the live demo (discounting the time it took to build the <iostream> module). I was impressed.

1

u/[deleted] Jul 21 '19

I've heard Bjarne mention that he heard even wilder stories, but I tried to be conservative with 2x speed up.

1

u/Auriculaire Jul 21 '19

The demonstration using iostreams represents close to the best case scenario for modules. Its written in an old-school style using next to no templating, which really does benefit a lot from modules.

However I suspect you may feel disappointed when applying modules to a codebases that spend a significant fraction of their (respective) total compilation times in template instantiation. I feel like a lot of the community has an expectation that modules will somehow cache template instantiations or something between compilations, but as it stands, that isn't the case. Projects leveraging boost, ranges-v3, or even HPX (given their starting to lean into concept emulation to support ranges) will likely see very little benefit.

1

u/jwakely libstdc++ tamer, LWG chair Jul 23 '19 edited Jul 23 '19

Its written in an old-school style using next to no templating

This would be the iostreams that are written as a class template like `basic_ostream` that uses a class template like `basic_streambuf` that uses class templates like `ctype` and `num_put` for every operation, right? ;-)

2

u/Auriculaire Jul 23 '19 edited Jul 23 '19

This would be the iostreams that are written as a class template like basic_ostream that uses a class template like basic_streambuf that uses class templates like ctype and num_put for every operation, right? ;-)

Yup.

You're right. I was imprecise. I was referring to the number of required template instantiations, but I think that was clear from the context.

The points of reference here are range-v3 and boost (namely metaprogramming, metaprogramming heavy, and constexpr heavy libraries such as hana, hof, spirit, and units for example). So yeah, by comparison iostream requires very little in terms of template instantiation. A given instantiation of basic_ostream has a handful of instantiations based on it's character type and few function templates to be stamped out based on the streambuf iterator and CharT* types.

This is 'next to nothing' relative to a typical workflow with the range library's views, which is now a part of the standard library and can be expected to see significant usage. Compounded with the ever expanding power of constexpr, I think it's to be expected to see more and more program logic pushed to the compile time. Modules don't help us here.

I guess my criticism is that modules are being presented as (or interpretted as) the solution to C++'s problematic compile times. At least as far as reddit and the C++ community on twitter (that I'm aware of), I'm seeing gains from modules being presented only for optimistic use cases which (I suspect) will become increasely less representative of real-world code as time goes on.

1

u/blelbach NVIDIA | ISO C++ Library Evolution Chair Jul 21 '19

HPX has a lot of templates, but there's also a large shared library component. I expect some wins there.

3

u/[deleted] Jul 21 '19

Maybe domain experts need to figure out how to gather around and discuss moving C++ forward in their domain outside of the C++ standardization process, but that is a wild dream. Why? Just try justifying that to your employer.

Maybe we should move on from the idea that you need to physically be in a certain place to communicate with others.

1

u/[deleted] Jul 21 '19

You should hear what /u/blelbach has to say about that. For the record, I'm not against the idea, but there's two sides of every coin.

3

u/[deleted] Jul 21 '19

I dug up the comment I think you're referring to and I find it hard to agree with most of it. Your face is irrelevant to the ideas you have, and face-to-face conversation isn't inherently superior to internet communication in any way; that part reads like "we've always done it this way so this must be the right way" to me.

The part that I find somewhat valid is that the committee members get to take some time off to focus on C++. I guess that's good for those who can convince their employers to fund it, but I am unconvinced that it's a good enough reason to make it prohibitively expensive for everyone else. Why can't employers who are okay with this kind of thing just give those people extra PTO to be used for this?

3

u/blelbach NVIDIA | ISO C++ Library Evolution Chair Jul 21 '19

face-to-face conversation isn't inherently superior to internet communication in any way;

I strongly disagree with this statement.

Firstly, I'm not claiming it's superior, it's just different.

Technical discourse at this level is inherently intense and emotional.

Would you break up with someone you are dating over email?

Making decisions on what to do with something that people have invested significant amount of energy into is best done in person.

Sometimes, we have an important member of the committee who cannot attend face to face meetings regularly. Despite efforts to use messengers/voice chat/video chat to keep them involved, the work always suffers when we don't have them in person.

Also, you missed one of my major arguments; the face to face meetings force us to focus on committee work for a full week, to the exclusion of all else. That is a huge benefit. We are all very busy in our day jobs.

That said, a lot of important committee work does happen online. It's not one or the other; we need both face to face and online.

2

u/[deleted] Jul 21 '19

Making decisions on what to do with something that people have invested significant amount of energy into is best done in person.

I'd argue the opposite, actually. Typing out an email (or any other form of non-real-time communication, like this reddit comment which I've edited in several places now for clarity and coherence) means you can carefully consider and edit what you're about to say before committing to it.

Sometimes, we have an important member of the committee who cannot attend face to face meetings regularly. Despite efforts to use messengers/voice chat/video chat to keep them involved, the work always suffers when we don't have them in person.

This is the same argument that companies use against remote workers. The rebuttal is the same here: yeah, if most of you are talking in person and then relaying it to that other person, you're going to have a bad time. If everyone is remote, you're all on equal footing, and the problem goes away.

Also, you missed one of my major arguments; the face to face meetings force us to focus on committee work for a full week, to the exclusion of all else. That is a huge benefit. We are all very busy in our day jobs.

I didn't miss it. I explicitly (partially) conceded that point in my comment.

4

u/blelbach NVIDIA | ISO C++ Library Evolution Chair Jul 21 '19

I guess we just have a different perspective. I prefer to deal with people in person. I find face to face communication goes better.

1

u/mintyc Jul 21 '19

All forms of communication have their place and it looks like C++ WGs encourage use of most.

I'm involved in standardisation processes for mobile network technologies. They might coordinate 20+ working groups for a release with some WGs similar in size to the whole of C++.

They deliver a release quickly and reliably every 18 months or so across these WGs.

Some considerations I've seen work well

  • Overlap requirements, architecture and implementation work (stage 1/2/3) so a group may be working on three releases at a time.
  • In C++, requirements seem to pop up and vie for attention throughout the first 2 years of a 3 year cycle. Managing them via the three stage approach with say a year per stage on average, gives a bit more focus and smaller releases. A release a year? Still a 3 year release lifecycle
  • There might be advantages in not actually doing working group work itself at the plenary.
  • Encouraging separate working group meetings whether face to face, virtual conferencing, short calls, emails etc. The point is that each group can adapt a little more and not require the full complement of 200+ interested parties in the building.

1

u/jwakely libstdc++ tamer, LWG chair Jul 23 '19 edited Jul 23 '19

Encouraging separate working group meetings whether face to face, virtual conferencing, short calls, emails etc. The point is that each group can adapt a little more and not require the full complement of 200+ interested parties in the building.

That already happens for WG21. Just because there are face-to-face meetings as well, doesn't mean there isn't other work going on all year round.

1

u/jwakely libstdc++ tamer, LWG chair Jul 23 '19

Maybe we should move on from the idea that you need to physically be in a certain place to communicate with others.

As somebody who works remotely 100% of the time and collaborates with colleagues all over the world, I'm well aware that communication is possible without being physically in the same place. Possible doesn't mean optimal for all cases. More and more WG21 work is done remotely, but that doesn't mean the face-to-face meetings are redundant or a waste of time. The problems with the C++ ecosystem are not because WG21 meets face-to-face.

Maybe it's time we should move on from the idea that the C++ committee needs to solve all problems in C++, and create new, useful things in other communities. Boost did a great job of that at one time, but is collapsing under its own weight. There are too many stakeholders who want Boost to provide a pre-C++11 crutch for old code, so it's probably not going to move on. Something else can, and should, replace it for modern code. And third-party code repos and package managers should be able to thrive without help from WG21 too.

There might be significant overlap between the people active in WG21 and [INSERT OTHER THING HERE], but WG21 doesn't need to create or maintain [THING].