4 ms·
I disagree with almost everything you said in that post; what's more, you're objectively wrong. Let's look at your claims. >Every new C++ article about the lat
by andrepd 8y ago
I disagree with almost everything you said in that post; what's more, you're objectively wrong. Let's look at your claims.
>Every new C++ article about the latest "improvements" to the language tends to confirm my belief that C++ developers are masochists. They don't seem to be interested in actually improving the language and making in better and easier at creating useful software. [...] The entire ecosystem feels like a infinite pile of new features fixing old ones, bringing new flaws in the process.
Can you give a concrete example? C++ evolution can be divided in roughly two eras: C++98, and Modern C++ (C++11 and above). This latter introduces a new philosophy, an expansion of features that make it look like a completely new language indeed. From ubiquitous type deduction, to lambdas, to compile-time computation without TMP, the language has introduced powerful new abstractions, always with the trademark "zero cost" that gives C++ its power.
>[Code snippet]
>I don't want a language with magic.
What about that snippet is magic that leaves you so appalled? You got a great (new) feature: guaranteed compile-time conditionals with the same syntax as regular if statements. Depending on whether the object has serialize or not, the code will instantiate to each of the branches, guaranteeing elision of a potentially expensive runtime check and branch.
>Show me simplicity and elegance. [...] Show me how I don't have to choose between value, reference, raw pointer, unique_ptr, shared_ptr, etc, to pass a damn parameter to your function.
Show me a language that simpler and more elegant than C++, where you don't have to worry about choosing how to pass parameters, or manage memory, and that still is as fast as C++. You simply can't, because there's no such thing. C++ delivers ZERO-COST ABSTRACTIONS, that's its power, that's its raison d'être. No other language I'm aware of that delivers this, apart from maybe Rust or D.
--
I realize it's hip to hate on C++, but please keep it rational.
- vvanders 8y ago> Show me a language that simpler and more elegant than C++, where you don't have to worry about choosing how to pass parameters, or manage memory, and that still is as fast as C++. As someone who built their career on memory constrained, fast code in C++ I'm gonna have to say that Rust is simpler and more elegant. You've got your zero cost abstractions, heck I can decided static vs dynamic dispatch at compile time. Lots of things are more explicit leading to less foot-guns that you see with implicit type conversion and the like. Borrow-checker catches all those nasty dataraces and ownership problems up front. I've yet to run across anything I could do in C++ that I can't do in Rust. Listen, I love C++ but I think you may want to expand your horizons a bit before declaring it the best language ever in this space.
- iainmerrick 8y agoEven if Rust is better than C++, that doesn’t mean C++ is bad.
- rootlocus 8y agoYes, actually, it does. Because C++'s mantra has always been zero cost abstractions. And people have defended the language because "you can't do better and still have the same performance". Well, it seems you can.
- blub 8y agoLanguages are never compared across a single dimension (except to prove a point on the internet).
- kllrnohj 8y agoRust does come with a different bag of complexity. I'm thrilled to see competition with C++ in this space finally and super excited about Rust, but let's not pretend Rust is easy, either. It has a notoriously monsterous learning curve (which is why there's a major focus to fix that curve: https://github.com/rust-lang/rust-roadmap/issues/17 https://github.com/rust-lang/rust-roadmap/issues/17 ) And in this particular context Rust also still forces you to figure out how to pass parameters and manage memory. It "just" helps you with when to call free, which std::unique_ptr also helps you with. Rust makes it a compile error to have a bug, which is awesome, but the "you have to figure out memory allocation & layout" complexity is still mostly there.
- vvanders 8y ago> It has a notoriously monsterous learning curve That learning curve exists in C++ too, it's just hidden under the iceberg of 'interesting' runtime behavior. There's nothing like trying to printf a data race only to have the print call insert a fence and make your data race disappear. > And in this particular context Rust also still forces you to figure out how to pass parameters and manage memory. This is a lot simpler in Rust. Everything is value type by default, Box<T> for heap allocations, which even then are managed mostly for you via RAII(yeah I know there's std::unique_ptr but you still also have new, delete, new[], delete[], etc). Parameter types are value, mut ref or const ref. Move semantics are implicit if you have a value type. You don't have const/volatile/etc function qualifiers. implicit type conversion(esp constructors) can be a total bastard and trip you up in nasty ways. Even more annoying if you're trying to bit-pack or do clever math. Rust got to learn from a lot of C++'s mistakes and is to me a better language for it.
- rootlocus 8y ago> No other language I'm aware of that delivers this, apart from maybe Rust or D. Reminds me of a great campaign speech from Donald Trump where he praises the border wall, saying there will be no way anyone could get down once they managed to climb it. Except maybe a rope. Good job proving your point by shooting yourself in the foot.
- m_myers 8y agoThis is the paradox: Every new language feature in C++ has, as you say, a rational argument for inclusion. Yet when you combine them, you get a language that I will never use if I have a choice.