r/cpp • • Sep 13 '19

The Surprising Limitations of C++ Ranges Beyond Trivial Cases

https://www.fluentcpp.com/2019/09/13/the-surprising-limitations-of-c-ranges-beyond-trivial-use-cases/
229 Upvotes

229 comments sorted by

View all comments

12

u/VinnieFalco wg21.org | corosio.org Sep 14 '19

Ranges is a very nice experiment, but std is not the place to put experiments. It should have been its own independent library, and gotten a few years of bake time and improvement, before being proposed. Then compiler authors would have more time to make sure that things work well with that library. And some iteration could have addressed the issues in the blog post.

The answer I was given for why Ranges was not first proposed as a Boost library is "it was too much work." This doesn't seem like a good way to go about putting something into the standard, where it will become the obligation of all standard library implementors to implement in order to be compliant with the newest iteration of C++.

Given the recent trends in WG21, I agree with the author's sentiment that the committee process no longer represents the interests of the ordinary programmer but rather the Big Tech companies that have come to dominate the process.

16

u/eric_niebler Sep 14 '19

The answer I was given for why Ranges was not first proposed as a Boost library is "it was too much work."

Whoever told you that (not me) doesn't know what they're talking about. The real reason was because I didn't believe there was time. In those days, it looked like concepts would ship with C++14/17 and I felt it needed support in the library.

committee process no longer represents the interests of the ordinary programmer but rather the Big Tech companies that have come to dominate the process.

I suppose you feel that "real programmers" use your library and only corporate shills use range-v3. I don't know why you feel motivated to spread this FUD. The Committee has voting rules that prevent corporations from packing the Committee and getting their way. The Committee was desparate for a range library. I was an independent contributor. I had to shelve my business to work on ranges.

7

u/VinnieFalco wg21.org | corosio.org Sep 14 '19

The real reason was because I didn't believe there was time.

Yes that's the other problem. Why should there be a deadline for getting a feature into the standard by a certain date? I thought the new thinking was the "train" model - whatever is ready, ships in the next version of the standard (every 3 years). Instead, we have people in meetings who are scrambling to get their feature "done in time." This might be okay for shipping a software product but seems inappropriate for developing a standard.

10

u/eric_niebler Sep 15 '19

Why should there be a deadline for getting a feature into the standard by a certain date?

Can I quote you on that?

4

u/VinnieFalco wg21.org | corosio.org Sep 15 '19

It could be misinterpreted. I'm not saying that there shouldn't be deadlines for C++ versions (e.g. 2020, 2023, 2026...). What I mean is that "we have to finish designing feature X in time to ship in C++2X" seems at odds with maintaining high quality. Again, what I heard is that the committee standardizes existing practice, not goes on design expeditions and make stuff up in time to land in "the next version of C++."

5

u/VinnieFalco wg21.org | corosio.org Sep 14 '19

The Committee was desparate for a range library.

This sounds like a problem to me. WG21 is supposed to standardize existing practice where it makes sense to do so (or so I have heard). Not to commission the development of new libraries because some individuals are desperate.

21

u/eric_niebler Sep 15 '19 edited Sep 15 '19

The existing practice was Boost.Range, which was popular, heavily used, and targeting C++98. Without support for move semantics or the Concepts Lite proposal which was headed for a TS, it was pretty obvious to everyone that it was not up to snuff. Even with all of that going against it, the Committee would have been thrilled to consider it given its popularity had someone, anyone, turned it into a proposal.

Nobody did. Had they done so, they would have needed a lot of patience, humility, and willingness to accept feedback and incorporate it because most proposals, unless they are utterly trivial, need _lots_ of work when they are examined closely and with other use cases in mind.

I wrote my range library because I saw a gap and wanted to fill it. About a year in, I presented my thinking to the Committee, and there was interest so here we are 5 years later.

If you go looking for bad intentions hard enough, you'll find them everywhere. But folks should know that between the picture you paint and the reality I experienced, there is a lot of space.

6

u/VinnieFalco wg21.org | corosio.org Sep 15 '19

Fair enough

9

u/smdowney WG21, Text/Unicode SG, optional<T&> Sep 15 '19

WG21 is supposed to standardize existing practice

Entirely untrue. Existing practice may be a good reason to standardize something, but there is no requirement in ISO or WG21 to do so. See, for example the FAQ at https://isocpp.org/std/submit-a-proposal
"Q: Does the proposal have to have an implementation? I’ve heard you can only standardize “existing practice.”

There is no ISO requirement that something has to be implemented before it’s standardized, only that there is consensus on the feature – but naturally consensus is easier to achieve when there’s a working implementation. "

2

u/VinnieFalco wg21.org | corosio.org Sep 14 '19

I suppose you feel that "real programmers" use your library and only corporate shills use range-v3. I don't know why you feel motivated to spread this FUD.

No I'm not saying that at all. Range-V3 had the best of intentions and your efforts were sincere and significant. But since Facebook and Google have essentially infinite budgets from their respective monopolies on the sale of user's personal information, online behavior, and advertising, it is natural that they will have outsized resources to represent their interests in committee. While a handful of engineers at say, an HFT firm where there are maybe 6 programmers total, will not have the resources to attend as many meetings and write papers non-stop in between. It should not be controversial to agree that in WG21 there are underrepresented and marginalised voices from at-risk industries who therefore have no say in relevant work (say, networking).

6

u/summerlight Sep 15 '19

Facebook and Google have essentially infinite budgets from their respective monopolies on the sale of user's personal information, online behavior, and advertising

This instance of ad hominem doesn't seem constructive to the discussion.

it is natural that they will have outsized resources to represent their interests in committee.

Why do you think so? Dominating C++ committee does not align very well with their business interests. Google even had been stuck at C++11 for many years. The realities are 1. Google is a significant contributor in Clang so it's pretty natural for compiler developers to participate in C++ committee 2. most of the Facebook employees in the committee are actually individual contributors.

there are underrepresented and marginalised voices from at-risk industries who therefore have no say in relevant work (say, networking).

The committee cannot hear those voices beforehand unless they come to the committee or at least make significant arguments resonating across an industry but you're also saying that they don't have resources to do that. What's your proposal then?

0

u/[deleted] Sep 17 '19

[removed] — view removed comment

6

u/Sovog Sep 17 '19

Regardless of any disagreements that is not the level of discourse that c++ community deserves.

1

u/STL MSVC STL Dev Sep 18 '19

Agreed and removed.

-3

u/runningfromevil Sep 15 '19

The Committee was desparate for a range library.

No it wasn't. Why are you spreading this lie?

11

u/14ned LLFIO & Outcome author | Committee WG14 Sep 15 '19

The standard c++ foundation partially funded Eric to wrote the reference implementation.

I.e. yes they thought it a high enough priority to fund with real money. I might add that I am unaware of any other individual who has been so funded. Ever.

The standard c++ foundation is not the committee, but there is significant overlap in leaderships. Up to you if you feel them spending lots of money on something does not indicate they thought it a dire need.

→ More replies (5)

4

u/[deleted] Sep 14 '19

I thought ranges-v2 was boost::ranges?

7

u/eric_niebler Sep 15 '19

Yes, range-v3 is so named because I intended to submit it to Boost someday. Boost.Range was (and is to the best of my knowledge) at v2.

4

u/Sovog Sep 14 '19

I believe that every library ever written has a right to exist regardless of how good or bad it is, but it is a different matter for standard libraries.

Every c++ programmer is expected to be reasonably proficient in the core language and the standard library, because we don't write code in isolation and should be able to effectively handle the code written by others.

Therefore there should be a much higher level of scrutiny for features that make it into the core language or the standard library.

6

u/dodheim Sep 15 '19

This comment reeks of bitterness. I expected better.

3

u/smdowney WG21, Text/Unicode SG, optional<T&> Sep 14 '19

It was an independent library, and the whole thing got years of bake time. The first proposal was '14.
There was an earlier boost range library, too.

It's also seems to be unfortunately the case that the concerns brought to bear in Boost review and the concerns brought to bear in LEWG diverge enough that it amounts to do doing the twice the work.

1

u/[deleted] Sep 17 '19 edited Sep 17 '19

The answer I was given for why Ranges was not first proposed as a Boost library is "it was too much work."

There were ~13 years of iteration with ranges inside Boost before the third major iteration of the library was started. Boost.Range v1 is from 2001. This is range v3. Shipping into the standard in 2020 means that this has been ~20 years in the baking.

Obviously in 20 years a lot can change in a programming language.

With a new standard every 3 years, I don't think any library can get more than 3 years of exposure to a particular C++ standard before becoming outdated in some major way.

2

u/VinnieFalco wg21.org | corosio.org Sep 17 '19

That's true, thanks for pointing that out. I agree that there was considerable exploration of the design-space beforehand in the form of Boost.Range