3 ms·
C++ is definitely complex, probably too complex, but "This language feature is best understood as an attempt to mitigate the complexity of this other language f
by gpderetta 2y ago
C++ is definitely complex, probably too complex, but "This language feature is best understood as an attempt to mitigate the complexity of this other language feature" is, aside from being wrong, needlessly inflammatory.
- sa1 2y agoCould you go into some details into how it's wrong and how you interpret this statement? Prima facie, it does seem correct to me.
- gpderetta 2y agoI'm not even sure what feature std::move is supposed to be mitigating. Certainly not overloading, in any meaningful sense.
- johnnyanmac 2y agoPrima facie: what does std::move look like it's trying to band-aid fix? copy operations? They expanded the Rule of 3 to the Rule of 5 for a reason. The operations work together. Move semantics simply work as an optimization when you know the data you're taking in won't be needed anymore and you can more or less "snatch" the data (to put it overly broadly). If you can't do that, you take a slow path and just copy properties one by one. Garbage collection? Well, besides these languages not having that, managed languages are making the exact same decisions under the hood when optimizing. if it knows a reference is being assigned but then goes out of scope, it can do similar move semantics to save on a copy.
- ajross 2y agoSigh. That statement was literally a very straightforward paraphrase[1] of the upthread point, which I even quoted. That one seems "inflammatory" and the other doesn't speaks more to the reader's perspective than the text's. But by all means, let's not debate programming language complexity and call people vacuous trolls instead. [1] "explanations fail because they don't focus on" -> "best understood as". I mean, come on. I'm not reading much bile here. You added that.