News for hackers. Stuff that matters.
Re:Popular Myths about C++, Part 1 by humanrebar on Tuesday December 09, 2014 @09:46AM (#8722959)
To be fair everything you're upset about is a problem with the standard C++ library, not the language itself.

Not to say that the language doesn't have issues. The initializer list example you provide is half of one, but only because people don't like to write algorithm-based code.

This is actually fine:

   auto v = {1, 2, 3, 5, 8, 13};
   for (auto i : v) {
       std::cout << i << '\n';
   }
...all that being said, the C++ standard library gets strings very wrong. I've ranted about it here before. But, to be fair:

1. What language gets strings right?

2. C++ has some interesting ideas around the bend (concepts) that should make using library code much easier. Whether writing library code will be easier is another question, but I'm hopeful.

Re:Popular Myths about C++, Part 1 by Retra on Tuesday December 09, 2014 @12:01PM (#8723899)
Standard libraries are part of the language. I would go so far as to say anybody who designs a language that isn't meant to make their standard libraries powerful, consistent, and elegant isn't doing any favors for the discipline.
Re:Popular Myths about C++, Part 1 by humanrebar on Tuesday December 09, 2014 @03:53PM (#8725643)
C++ is a bit different in the variety of domains that it's applied to. To expect the same standard library to be useful in games, microcontrollers, medical instruments, aircraft control systems, kernels, and CRUD apps is a huge ask.

Maybe you don't like that, which is fine. But C++ is much broader than what's available in the standard library. C++ is a close second to C in the "how optional is the standard library?" contest.

Re:Popular Myths about C++, Part 1 by mikeash on Tuesday December 09, 2014 @09:55AM (#8723028)
The standard library is part of the language. But that aside, the fact that + doesn't work on string literals cannot possibly be a problem with the standard library. The fact that the language lets you extend + to work with some types but not others is not a problem with the standard library.

As for initializer lists, the problem isn't simply that {} doesn't produce a vector, it's that identical-looking constructs do completely different things in different contexts. a = b can do completely different things depending on where you see it and what declarations are visible and on and on. Again, not a problem with the standard library.

The standard library suffers from these problems, as it must since it exists within the language that causes them. But the problems are not in the standard library.

Re:Popular Myths about C++, Part 1 by claudius on Tuesday December 09, 2014 @10:14AM (#8723165)
> a = b can do completely different things depending on where you see it and what declarations are visible and on and on.

I don’t see your problem with this. "a + b" certainly can and should do "completely different things depending on where you see it" and "+" is commonly used in completely different contexts in real-world usage, too, e.g. integer addition, integer addition modulo x, real number addition, complex number addition, vector addition, matrix addition, vector space addition, set addition/union etc. etc.

To restrict "+" to only act on integers (or reals?) and require a +_real, +_complex, +_vector, +_matrix etc. seems unreasonable.

Now, given that "+" may well do whatever it seems fit with its two operands, why should "=" not be allowed to do the same?