10 ms·
Sorry for my ignorance, but my impression was that in the native spaces the consesus is that Rust is the only reasonable choice for any new code. So I don’t und
by layoutIfNeeded 8y ago
Sorry for my ignorance, but my impression was that in the native spaces the consesus is that Rust is the only reasonable choice for any new code. So I don’t understand why people are still working on a C2x standard - shouldn’t the native community work on a roadmap to migrate the existing legacy C/C++ codebases to Rust instead? Am I missing something here?
- jfk13 8y agoPerhaps the "migrate the existing legacy C/C++ codebases to Rust" problem is a lot bigger than you're imagining?
- 0815test 8y agoWe're all just waiting for a formal Rust Reference Manual to be published, so that the official ANSI/ISO C and C++ standards can be replaced by a single-line reference to that. Since all practical C/C++ programs will necessarily invoke undefined behavior at some point, doing this is even 100% legal by the previous versions of these standards, even though it means rejecting the older C/C++ syntax altogether; it's really just replacing runtime nasal demons with a far more benign compile-time diagnostic!
- WoodenChair 8y ago> Sorry for my ignorance, but my impression was that in the native spaces the consesus is that Rust is the only reasonable choice for any new code. Please tell that to the many millions of C/C++ programmers writing new code every day, who are only vaguely familiar with Rust if at all. If by consensus you mean "consensus amongst the vanguard of Hacker News" then yes. If you mean "consensus" as in the "consensus of the software development industry" then absolutely not.
- adamnemecek 8y agoIf you program but don’t post about it on HN, are you really programming?
- aduitsis 8y agoNot really, no. Also, Perl does not exist and is actually an urban legend from the '90s.
- v_lisivka 8y ago> Please tell that to the many millions of C/C++ programmers writing new code every day, who are only vaguely familiar with Rust if at all. Just call it "C20", and they will learn it in a week.
- CJefferson 8y agoI love Rust, but there are so many places it isn't feasible (yet). Most microcontroller don't support it for a start.
- Ericson2314 8y agoEh is think you can make it for anywhere you can use C and clang. Manufacturers write such shit code anywway I don't midnight not using their boilerplate at all.
- detaro 8y agoSuch a consensus does in no way exist (even if you assume that there's a consensus on "we need to replace C and C++", which there also isn't, Rust isn't the only "better" native language), and "all new code must be Rust" is mostly a meme by overly enthusiastic enthusiasts. Rust is a tiny sliver of native code written today, not to speak of the orders of magnitude bigger collection of existing code bases and tooling existing outside of it.
- raphlinus 8y agoIn addition, it is entirely possible that when Rust has a formal semantics, it will use exactly such a provenance-aware memory object model to describe which pointer operations are safe and which lead to UB. People using the safe fragment of Rust won't care about this, but that's certainly not all of Rust.
- pjmlp 8y agoRust is very nice as safe systems programming language. But every sane safety advocate also acknowledges that we aren't going to throw away the millions of lines written in C and C++ tomorrow, and there needs to be a way to keep UNIX derived platforms, while improving their security.
- vvanders 8y agoThat's why Rust's FFI story of being the C ABI is wonderful. I've used tons of c libraries but still get to take advantage of Rust's advantages in all the new code I write.
- jandrewrogers 8y agoYou are missing that Rust still can't do many things as well, or as efficiently, or at all as e.g. C++17. It is not suitable for many domains of systems programming. Some safe, simple, idiomatic C++ code is difficult or impossible to express in Rust. Some important safety features in modern C++ don't exist in Rust, so you'd need to remove them from the code base or rewrite the code using a less safe design. There is room for a new systems programming language but the current solution to the above issues is to make the code "unsafe", slower, and/or more bloated, which offsets its nominal benefits. For many C++ software architectures, memory safety is a non-issue in practice, so that isn't always a compelling feature. The benefits of Rust versus C++ are significantly overstated by its fans, and its current limitations tend to be overlooked. (I can't speak for C, it has been too long since I worked with it at scale.)
- c-cube 8y agoWhat safety feature does rust lack exactly? I know C++ has some more expressive features (like templates on values), but safety? C++ is as unsafe as it gets…
- The_rationalist 8y agoOn the langage on itself rust lack many expressives features (but "slowly" catch up) that modern c++ has. As for memory safety, I'm not aware of safety features on the Langage on itself but the rust tooling is like third world in comparison. First of all rust has a very incomplete sanitizers support. Ubsan, Msan etc https://github.com/rust-lang/rust/issues/39699 https://github.com/rust-lang/rust/issues/39699 Secondly there is an order of magnitude more static analysis tools that support cpp than rust (but Facebook (a leader in static analysis) is developing a promising one for rust. As for Fuzzers I'm not aware if they're Langage agnostic. Finally there are less (if none?) program provers for rust code.
- wwright 8y agoSanitizers and fuzzers are a valid complaint, but static analysis is much less of a problem for Rust vs C++. Most of the issues C++ analyzers detect are prevented by Rust’s design itself, and Rust has an official analyzer in Clippy. Provers are also a fair complaint, though it’s going to be comparatively super rare that that is an issue in practice :p