4 ms·
> "Yup, all the things you mentioned are also available in C++, and you've been ignoring and criticizing them for years" Even that's not true. One of the prac
by twic 8y ago
> "Yup, all the things you mentioned are also available in C++, and you've been ignoring and criticizing them for years"
Even that's not true.
One of the practically valuable things about Rust is that it has a decent and standardised package manager and build tool. C++ does not, and is nowhere close to having that.
Another is that the Rust libraries use iterators as a straightforward, composable, and efficient way to write operations on streams of values. The C++ standard library doesn't have anything like that.
Rust has a really powerful macro system. C++ doesn't. It has template metaprogramming, which can do most of what macros can, but it's agony to use. C++ is getting some really powerful compile-time programming facilities, but those aren't in a standard yet.
There are a lot of things in Rust that are in C++. There are things in C++ that are not in Rust (some of them even useful!). But there are things in Rust that aren't in C++, and when C++ loyalists say there aren't, they just look stupid.
- est31 8y agoThanks for comparing C++ templates to Rust's macro system and not to Rust's generics. The template system that C++ has is actually closer to Rust macros than it is to Rust generics, and I think a common misconception. This is e.g. something that people who complain that C++ has const generics while Rust doesn't should keep in mind.
- barrkel 8y agoRust is in many ways more powerful because of what it can't do than what it can. Good constraints are liberating; they raise the level of what you can trust about your environment.
- tomnj 8y agoI love C++ (though it often frustrates me), and I think Rust is doing some awesome things (though I don’t work in it). A few clarifications: Your point about iterators and composability: you’re right, the STL suffers a bit here, but Eric Neibler’s ranges library (which is partially approved for C++20) addresses this. > Compile time programming ... aren’t in a standard yet. There compile time programming story in C++ has been getting better and better, and has made great strides with recent standards (check out constexpr, which arrived in C++11). > template meta programming is an agony to use. Many people would agree with you, but it’s a matter of taste :). It’s “just functional programming” (with an arguably terrible syntax). I’m very jealous of many rust features, like built in algebraic data types, pattern matching, but most of all their build and package stories.
- ilovecaching 8y agoI'm curious, what would it take to get you to completely ditch C++ in favor of Rust?
- tomnj 8y agoCompletely? I’m not sure. I need to try more Rust. But not having to write another CMakeList sounds pretty good for starters :)
- marcosdumay 8y agoNo, constexpr is in no way similar to the compile-time programing available on Rust. It's not on the same ballpark, it mostly does not have similar goals. > It’s “just functional programming” Well, yes, it's just functional programming where all the data is text, you don't get to query or debug intermediate values, and functions aren't even first class. That's to say, it's a pure language, and lacks all the other features of modern FP languages.
- twic 8y agoConstexpr is not bad, but not macros. Macros can do things like generate new types, and add methods existing types. That's crucial for things like custom derive. C++ will get that sort of thing from the metaclasses proposal, which slouches towards WG21 to be born: https://www.fluentcpp.com/2017/08/04/metaclasses-cpp-summary/ https://www.fluentcpp.com/2017/08/04/metaclasses-cpp-summary...