4 ms·
If C++ was an octopus made by stapling extra legs to a dog, it's now just a giant pile of legs, and nobody's heard a bark in decades.
by arcticbull 6y ago
If C++ was an octopus made by stapling extra legs to a dog, it's now just a giant pile of legs, and nobody's heard a bark in decades.
- deleted 6y ago[deleted]
- sudopluto 6y agowhat a snarky and unproductive statement
- ttul 6y agoAlternatively, C++ is an extremely mature language that has evolved through a painstakingly well considered process involving some of the brightest minds in computer science across multiple decades. It continues to deliver on the promise of providing the structure you want, without any undue runtime cost.
- arcticbull 6y agoMy criticism stems more from C++'s steadfast refusal to drop backwards compatibility, in any way, for anyone, ever -- while also adding new features. What this means is that new features can't provide the guarantees they can in other environments leading to "ruined fresco" [1] syndrome. Concrete example: std::move. Move constructors can copy, and `std::move` doesn't move. Naturally, it just casts your T onto `std::remove_reference_t<T>&&`. Because why not. It also leaves your source object in an undefined but totally accessible state -- whose validity is up to the implementor's convention! I think std:: collections are totally useable after they've been moved (correct me if I'm wrong) but your own types may just explode or fail silently. Talk about a giant footgun. This approach leads to poor imitations of features from other languages getting stacked on top of the rickety footbridge that is K&R C. It's specifically the evolutionary design philosophy that I take issue with. The language has become borderline impossible to reason about. Quickly, what's the difference between a glvalue, prvalue, xvalue, lvalue, and an rvalue? And the compiler, in the name of backwards compatibility, sets out not to help you because adding a new warning might be a breaking change. I've got easily 15 years of experience with C++ - granted, not daily or anything. To figure out what's actually happening, you need to understand 30 years of caveats and edge cases. [1] https://www.npr.org/sections/thetwo-way/2012/09/20/161466361/woman-who-ruined-fresco-of-jesus-now-wants-to-be-paid https://www.npr.org/sections/thetwo-way/2012/09/20/161466361...
- jcelerier 6y ago> but your own types may just explode or fail silently. I mean, that's the point of them being "your own types". If you couldn't do anything that you want, including putting `assert(1 == 2)` in any method of your own type in C++... then people would be quick to design a Cwhatever language where you can, because it's a useful subspace of the design space of programming languages
- deleted 6y ago[deleted]
- skeletal88 6y agoIf it wasn't backwards compatible then it would be a new language. Compilers keep adding new warnings all the time. If someone's build is broken by -Werror then they should disable that warning, if it isn't relevant to them.
- arcticbull 6y agoCertainly the C committee considers standardizing warnings to be a breaking change so that's not always true. [1] Re: backwards compatibility, that's not really true. ABI compatibility is different than source-level compatibility. If a library or module is built to one language standard, so long as the ABI remains compatible, I think it's fair game to change syntax and semantics when compiling with a newer language release - especially when there's clear and obvious deficiencies in the existing. Obviously, the committee and I disagree on this. However, my point remains that if you value backwards compatibility above all else, and it's that backwards compatibility that actually prevents you from adding features in a complete and honest way, maybe don't add the feature. Like, if `std::move` is the best you can muster, don't add it! It's not a move! I don't know what it is, but it's definitely not what the label on the tin says. [1] https://thephd.github.io/your-c-compiler-and-standard-library-will-not-help-you https://thephd.github.io/your-c-compiler-and-standard-librar...
- MauranKilom 6y ago
- littlestymaar 6y agoThat's funny. That's not a great description of the reality, but you can't get make a comment both accurate and funny at the same time.