6 ms·
Rust is the next C++. There, I said it.
by wheelerof4te 4y ago
Rust is the next C++.
There, I said it.
- Kukumber 4y agoRust can't be the next C++ since it can't consume the C++ ecosystem
- marcosdumay 4y agoWell, "the next C++" won't be one language. But yes, to the extent that C++ still had some niche before Rust matured, that last niche doesn't exist anymore. I disagree even that Rust was the largest C++ killer, but it seems to really be the last one.
- eklitzke 4y agoThe problem with Rust is that it's not compatible with C++ other than at a C FFI level. Rust code can't really interact with C++ code that uses templates, which is pretty much all of it. That makes it a non-starter for companies that have millions of lines of C++. Incidentally this is why there's basically no Rust in the Google monorepo. Rust might be slightly better than C++, but it's not a lot better, and bifurcating the entire ecosystem for something that is marginally better isn't worth it.
- dang 4y agoPlease don't post unsubstantive or flamebait comments or take HN threads on generic flamewar tangents. https://news.ycombinator.com/newsguidelines.html https://news.ycombinator.com/newsguidelines.html
- VHRanger 4y agoDidn't fix the actual annoyances I have with C++: - Long build times - Overly complex language - Ugly syntax
- deleted 4y ago[deleted]
- simplotek 4y ago> Long build times Build times in C++ projects nowadays are mainly the result of naive approaches to project structure and total lack of care towards modularity. On top of that we also have helpers such as ccache and the like to further reduce build times by not having to build at all.
- wheelerof4te 4y agoYeah, that's the one of the points of my comment. Rust inherited a lot of problems C++ had. While making some progress in areas such as security is a huge success already, the language has a lot of potential to do more.
- Daishiman 4y agoThe long build times are a product of the type safety mechanisms built in. The language complexity is also a result of the qualities required for a low level language that can manage memory and resources with precision. Ugly syntax is subjective; I find it expresses cleanly most of the things you want in the domain. Those are not really priorities of Rust or most of its domains anyway.
- lifthrasiir 4y agoInterestingly enough, there is actually a bit of common misconception going. Rust compiles pretty quick if you don't generate binary. If you don't believe me you can compare `cargo check` and `cargo build` yourself. The current bottleneck of Rust compilation time is actually LLVM; there has been lots of efforts to reduce this (including MIR, because less code passed to LLVM means less time spent in LLVM), but LLVM performance still remains a major factor.
- 4y ago
- ubj 4y agoWhile I acknowledge that there's still plenty to debate about C++ vs Rust, Rust has several extremely nice features that are more difficult to emulate in C++: * Rust has a package manager. * Rust has macros. * Rust makes it relatively simple to choose between compile-time and runtime polymorphism. * Rust's traits can be more flexible than C++'s classes. Rust feels like a modern language. Modern C++ feels like it's struggling under the massive weight of decades of cruft.
- PartiallyTyped 4y agoI'd add compatibility across versions, and extensibility of the language via macros.
- Ragnarork 4y ago(Disclaimer: I'm not a rust expert by any means so bear with me, I'm also genuinely interested in the language) * While not perfect, C++ has a few package manager that are quite solid (personal favorite being conan). * What can Rust macros do that C++ TMP (and macros even though that's a last resort IMHO...) can't do? * From what I've gathered, it's similar in complexity to using the CRTP in C++, maybe a bit less verbose. Am I missing something? * I feel like "interfaces" as in pure abstract virtual classes can achieve the same effect as Rust traits (though it could be its own thing and not a special case of a class specification), and the newly introduced Concepts goes even further that what can be achieved. Don't get me wrong, I like the improvements rust brought, especially in terms of safety, but other than that... I don't think C++ is particularly far, or even actually behind for some of these.
- sqeaky 4y agoC++ dev here, not a rust dev. It is my understanding that Rust macros have some understanding of the syntax/parse tree, making them much safer than text replacement like c++ macros. A better comparison to Rust macros might be constexpr and template meta-programming.
- lifthrasiir 4y ago> What can Rust macros do that C++ TMP (and macros even though that's a last resort IMHO...) can't do? I'm not sure why you specifically compare Rust macros with C++ TMP. Rust macros are meant to be a safer and more flexible alternative to C/C++ macros, not else. C++ TMP is not a goal but a means to the goal, so if you look for something like TMP in Rust you will see nothing (the closest is generics, but of course it doesn't subsume TMP because it needn't). The goal of TMP is generically a compile-time metaprogramming and Rust has multiple solutions for this, including but not limited to generics, Cargo-directed code generation (via `build.rs`), macros by examples (`macro_rules!`) and procedural macros. > From what I've gathered, it's similar in complexity to using the CRTP in C++, maybe a bit less verbose. Am I missing something? CRTP (curiously recurring template pattern) is really aptly named and it is a testament to C++'s accidental complexity. I don't think any new C++ user can discover CRTP in reasonable time. In Rust traits are built-in and well incorporated into the core language. > I feel like "interfaces" as in pure abstract virtual classes can achieve the same effect as Rust traits (though it could be its own thing and not a special case of a class specification), and the newly introduced Concepts goes even further that what can be achieved. You have a generally right idea about traits that it is conceptually similar to concepts, but I believe there is currently no equivalent of `dyn Trait` for concepts. There was no effort to harmonize concepts and existing virtual classes. Also your parenthesized remark is more important than you imagine; `dyn Trait` in Rust is implemented as a fat pointer, which decouples vtables from instances and is generally much less complex than C++ vtables which have to account for multiple inheritance for example. As a C++ programmer you may feel like that you want a choice between vtable and virtual methods vs. no vtable and no virtual methods, but it is a false dichotomy and Rust gives the best of both "choices".
- mewmew07 4y agoso what comes after rust? Please don't say rust++, I'm curious as to what the next thing will look like. Maybe I have to a bit longer
- marcosdumay 4y agoMy bet is on a simplified Rust that consolidates a lot of ideas into fewer features. But people will need some time to create that.
- dwaite 4y agoIf something replaces Rust, I hope they make an effort to simplify the design space. Rust's complexity comes from the desired featureset. I believe much of C++'s complexity does not come from its C heritage, but rather from having defined the primitives to control memory usage, object lifetime, and layout.
- richardwhiuk 4y agoWait a lot longer. Probably 10 or 20 years. After that, we'll know if Rust is the next C++ and also what the next big deals are.
- scoutt 4y ago> so what comes after rust? rust.iter().next();
- distcs 4y agoRust is already hard and complex enough. I worry that Rust++ would be a monster like Kraken that would chew a young programmer me at one end and spew out an old and confused person who is struggling to understand how all his youthful life passed by without even realizing that it did.
- dyingkneepad 4y agoSome Google people were trying another newer language and I completely forgot its name. People were joking around here that Rust was a thing of the past now.