News for hackers. Stuff that matters.
Re:C++20 Ranges by tomnj on Saturday December 22, 2018 @07:25PM (#18743455)
This is library code which most users of the range library will not themselves need to write. Using ranges absolutely leads to shorter and more elegant code. The implementation of the library is complicated. Much of what’s likely unfamiliar with this example is the use of C++ “concepts” (a technical term), and is not actually necessary, but is placed there to actually give better error messages to users of the library (without them, template code is basically duck-typed, and can give terrible error messages). I’d argue that the core of that code: the transform followed by the join is actually quite readable.

I also wouldn’t at all say C++ is overly academic. It’s an extremely pragmatic community. Yes, the standardization process is slow, but I don’t view, as a C++ user, the issues you mention as serious. To me, there’s nothing wrong with using high quality third party libraries like boost (and Eric’s range v3 library). My biggest frustrations with C++ are the build and packaging stories.

Re:C++20 Ranges by Something1234 on Saturday December 22, 2018 @08:15PM (#18743698)
Boost is not high quality. It massively balloons the compile time, and there's random incompatibilities between minor versions. It's also a hunt to figure out which header I need to include for certain libraries. There's no consistent feeling to the library. My biggest gripe is that it makes vims completion stupid slow by bringing in a large number of headers.
Re:C++20 Ranges by fermienrico on Saturday December 22, 2018 @09:39PM (#18744063)
You're talking about compile time and issues with your IDE. It is unfair to call it "Not high quality". We can think about this from an end-user standpoint that it bloats the IDE and impacts usability. Fine. Your IDE/compile times may be different than others.

Boost is extremely high quality in terms of its documentation, algorithms, and readability of the code - which is its core purpose. Please don't conflate your minor development environment gripes with the excellence of Boost. It is really not fair.

Re:C++20 Ranges by jlarocco on Saturday December 22, 2018 @10:29PM (#18744222)
I don't think it's an unfair complaint. Developers interface with the language using compilers and IDEs, and until recently (with libclang getting more popular) that interface has been terrible. In a lot of cases it's still terrible. It's a real inconvenience, and there's no benefit coming with the cost.

> Boost is extremely high quality in terms of its documentation, algorithms, and readability of the code - which is its core purpose.

I've used Boost for over a decade now, and IMO "extremely high quality" is a stretch. Some modules are better than others, but there's no getting around the fact that many of them are only necessary because the C++ standard library is so bad.

Re:C++20 Ranges by fermienrico on Saturday December 22, 2018 @11:41PM (#18744475)
I am having a hard time conciling compile times as a complaint. That is a compiler problem. Or an inevitable problem as the project grows.

I don’t understand how that is a problem with Boost.

Same thing with the IDE. If you add an external library such as Boost, it is natural that your intellisense or whatever IDE feature may get slower.

Both of these are undisputably an issue with the environment as a whole. How on the earth is it a quality problem with Boost!? Please explain.

Re:C++20 Ranges by a_t48 on Sunday December 23, 2018 @02:28AM (#18744925)
Not OP but - Boost is a large library that can be tricky to extract only the portions you want from, leading to instances where you compile a lot of unwanted code, leading to ballooning compile times in exchange for only a little bit of extra functionality that you want. In my experience boost typically ends up being all or nothing, and very hard to remove once integrated.
Re:C++20 Ranges by renox on Sunday December 23, 2018 @08:14AM (#18745889)
Has been terrible? IMHO (eclipse and clion user) for C++ big projects the IDE experience is terrible! Vim isn't better as you need to spend a lot of time configuring it plus ctags and multiple tabs doesn't work well together..
Re:C++20 Ranges by humanrebar on Saturday December 22, 2018 @09:59PM (#18744123)
Your viewpoint is valid.

But so is the viewpoint that one of the major problems with C++ culture is the misconception that developer experience and high quality tooling are afterthoughts and orthogonal to "quality". In this viewpoint, readability in a editor or IDE at least as important as readability in a browser or email.

Re:C++20 Ranges by fermienrico on Saturday December 22, 2018 @10:07PM (#18744146)
I agree that C++ is a big mess.

Complaining about an external third party library that is trying to fix the issues for its compile time and how fast it loads IDE is very obtuse and unfair. Boost is a bandaid. Don't complain about the bandaid, complain about what causes the wound. Overall, I agree with you that C++ has poor user-experience - don't blame Boost for it!

Re:C++20 Ranges by int_19h on Sunday December 23, 2018 @04:11AM (#18745199)
To be fair, it is very common to hear "well, why don't you just use Boost?" in response to the criticism of the C++ standard library. It may be an external third party library in name, but in practice it has long since became stdlib++ for idiomatic C++, and a testing ground for new libraries to be eventually adopted into the standard.
Re:C++20 Ranges by gpderetta on Saturday December 22, 2018 @09:36PM (#18744051)
> There's no consistent feeling to the library

Well that's because it is really a collection of mostly unrelated libraries by a large number of different authors.

There is some general theme (emphasis on value based generic programming in the stl style as opposed to more traditional Oop), but that's about it.

Re:C++20 Ranges by gumby on Saturday December 22, 2018 @08:26PM (#18743742)
Finally! It's not just me.

But...I will say some good ideas made it into the standard thanks to a first implementation in boost, though what ended up being standardized is typically much cleaner and more orthogonal.

Then again this is how we got the standard containers and so much more standard library goodness -- via Stepanov stepping up and writing the STL.

The best way to think of boost as the npm.

Re:C++20 Ranges by tomnj on Saturday December 22, 2018 @09:17PM (#18743977)
> boost is not high quality

This is just false.

Re:C++20 Ranges by AnimalMuppet on Saturday December 22, 2018 @11:14PM (#18744385)
You could be right. But this is not a convincing rebuttal.
Re:C++20 Ranges by btschaegg on Sunday December 23, 2018 @10:56AM (#18746728)
While I tend to agree with your points overall, I'd like to point out that this part irks me a bit:

> and is not actually necessary, but is placed there to actually give better error messages to users of the library

That's not the first time I see this kind of reasoning; you can find it all over programming. If the alternative is an API that sucks (and yes, template errors in C++ do suck), picking that alternative is not a very viable option.

Another scenario where this often pops up is whenever someone complains about very verbose error handling. If you want to write quality software, you shouldn't just skip that part (in fact I'd say it's the most important part of the code you're writing). In the same vein, there's a talk by Andrei Alexandrescu somewhere (on D), where he points out that probably 0% of the main functions ever written in C or C++ are correct in that they catch everything that can go wrong.

Also, since I find that most code should be written in a library style (i.e reusable, well-encapsulated) except if it's explicitly tied to a specific program (say config or cli argument parsing), I also don't find "only library implementers will have to deal with this" is a convincing argument. OTOH, at least, writing in a library style doesn't necessarily imply overly generic code, so that might not be that much of an issue.

Re:C++20 Ranges by contravariant on Saturday December 22, 2018 @08:21PM (#18743719)
I'm not convinced by the argument that it's fine since most people can just use a library someone else wrote. Requiring complex code to do something simple doesn't bode well if you want to try something complex. And when judging a programming a language it's a bit weird to reason from the perspective of someone not writing the code.
Re:C++20 Ranges by tomnj on Saturday December 22, 2018 @09:16PM (#18743971)
Nothing comes for free though. While we can easily write list comprehensions in Haskell or Python, their implementations are complicated. In the case of Haskell and Python, lists and comprehensions are language features, and for C++ ranges, they’re implemented as a library. Both approaches provide building blocks for users to build software and not have to roll their own implementations.
Re:C++20 Ranges by marcosdumay on Saturday December 22, 2018 @09:40PM (#18744067)
Haskell list comprehensions are a small layer of syntactic sugar over the monadic implementation, that is implemented on a library (that comes with the compiler, but it's still a library).

It is entirely dependent on lazynes, first class functions and complex compiler optimizations. But there isn't much specific code for comprehensions there.