9 ms·
Whats with the treand of why X should move to Rust these days? Not saying Rust is flavour of the week but this happens with a new language every couple of yea
by IceWreck 6y ago
Whats with the treand of why X should move to Rust these days?
Not saying Rust is flavour of the week but this happens with a new language every couple of years. Everything doesn't need to be rewritten. You switch languages, you might fix some existing bugs but you open lots of other ones.
- steveklabnik 6y agoThis blog post discusses specifically what would be gained by moving to Rust, and why Rust. The word "re-write" does not appear. It is actually suggesting that new work be started in Rust. It even suggests that re-writing what's there is a bad idea!
- rectang 6y agoYou'd never know that the blog post describes such an incremental strategy from all the top-level posts on this page rushing to argue against the straw man of a complete rewrite. :\
- vlovich123 6y agoLike almost even those that claimed to read the article did so haphazardly.
- ghostwriter 6y agoIt suggests two things at the same time - that a re-write would be great - "If people want to convert QEMU to Rust that would be great" - and that the author has other thoughts too.
- nicoburns 6y agoThe story for C/C++ software is a bit different. It has an order of magnitude more security issues than (similarly well written) software in other languages. Mostly because of memory issues. Partly due to undefined behaviour. There's a lot of this software. And until recently C and C++ were more or less the only viable options for writing it. Now there's Rust, and it has the potential to bring rates of security issues down to the levels of other memory safe languages (or even lower - Rust actually has protections against things like thread-safety issues that languages like Java don't). If the language didn't matter, then we'd all be writing in assembly code. It can make a big difference.
- badsectoracula 6y ago> has an order of magnitude more security issues But then there is a LOT more C/C++ software as well, so it makes sense that when you have a lot more code you'll also have a lot more bugs. > than (similarly well written) software in other languages. Why isn't that similarly well written software being used instead of the C/C++ software when the latter ends up with more bugs? > And until recently C and C++ were more or less the only viable options for writing it. I do not think that this is the case, there have been alternatives for pretty much as long as C existed. For example Object Pascal existed for decades before Rust and while it doesn't have as many compile-time guarantees as Rust does, it still is safer than C and C++, provides a similar amount of functionality while not losing in terms of low level functionality. Yet outside of a few exceptions (mainly during Borland's heyday) people still went with C or C++ despite those languages not providing anything special compared to it. And there have been other languages too - i've seen Ada being brought up often as a much safer language (safer than Pascal too) with a strong type system, yet still being usable even on tiny devices. What makes people stick with C and C++ when other solutions existed for years and how would Rust change that when other languages apparently failed?
- swsieber 6y ago> But then there is a LOT more C/C++ software as well, so it makes sense that when you have a lot more code you'll also have a lot more bugs. 70% of C/C++ security bugs are memory management bugs. Those don't (for the most part) exist in GC'd or other non-manually managed memory languages. > Why isn't that similarly well written software being used instead of the C/C++ software when the latter ends up with more bugs? Performance and low level control. Familiarity. etc.
- steveklabnik 6y ago(The statistic you're citing did not separate by language, it was "70% of security bugs are memory safety bugs" only, no language break-out.)
- 6y ago
- UK-Al05 6y agoIt's because c or c++ hasn't had a decent alternative for a long time. Rust has the ability to compete with them. Other languages don't. So it's ripe for distrupting projects that are normally written in c.
- badsectoracula 6y agoThere have been alternatives to those languages pretty much as long as they existed. Pascal was a common alternative to C for example, as was Object Pascal for C++ (both appearing around the same time) and Ada also existed for years and provided a much safer alternative to any of those while still being usable for low level programming. Yet C and C++ still persisted. What makes Rust different this time?
- UK-Al05 6y agoThey don't provide as much advantage over c to make the transition worth it. Rust has more advantages than Pascal. A single implementation. A decent package manager, lifetimes, sum types, all the infrastructure around sum types etc
- badsectoracula 6y agoPascal had a single defacto implementation (UCSD Pascal at first, Borland later) for each of the platforms so that wasn't really much of an issue. Ada is a standardized language. And C and C++ (especially C++) were not standardized for a long time and even after they were, most programs relied a lot on compiler-specific behavior. Pascal does have sum types (called variant records) and AFAIK had those since the beginning. Not sure about how exactly Ada does its memory management, but AFAIK it isn't a free-for-all like in C or C++, most dynamic objects are stored in containers which handle memory and any custom memory management must be done in explicitly designated ways (which it doesn't sound very different than Rust's unsafe code). So while Rust does add some stuff, i do not think that they are that much of an improvement over other existing languages (remember that many thought C was a step backwards compared to what other languages provided even at the time). Rust may add a lot compared to C, but very little when compared to other languages. Also note that i brought up Pascal and Ada as examples here, but those aren't the only alternatives to C and C++ that existed, just a couple that came to my mind. Of course there have been other languages.
- otabdeveloper4 6y ago> (C++) programming is hard, let's go (language) shopping! There isn't really a trend, those who can are doing it in C++, those who can't are teaching us about the wonders of rewriting in a more fashionable language.
- torb-xyz 6y agoBecause sometimes a software project has specific problems which Rust specifically address. (Not that I'm personally a big fan of all these call to rewrite in Rust posts, there's a reason the Rust subreddit discourages ”X should be rewritten in Rust” posts)
- eggsnbacon1 6y agoI've used a decent amount of Rust, that's not the case this time. Rust is a game changer. The effect of borrow checker and automatic RAII everywhere is profound. I'm convinced its going to fundamentally change low level language design. Borrowing semantics will be mainstream someday, whether its through Rust or otherwise. It has all of the safety characteristics of a VM language but its low level with no runtime. Its a direct replacement for C with all the performance and modern design of languages like Java and Go. And it uses LLVM so FFI with other languages that compile to native is simple and zero overhead. You can even do whole program optimization (LTO) on the combined binary, that's huge. Trust me the hype about Rust is real. Much more real than the hype around Go, which to me just feels like yet another GC language. The hyped AOT compilation is nothing profound. Since the GC forces Go to have a runtime anyways IMO they should have gone all the way and just used JIT. And Go doesn't use existing C compilers so FFI has overhead, can't be optimized together at a bytecode level
- zozbot234 6y agoI think this is a bit overstated, because Rust does not yet address all use cases of a language with tracing GC (such as general graphs, or some specialized concurrent data structures), so something like Go will still be useful in many cases. Though this might change in the future if Rust itself gains better support for "pluggable", local allocators, whicn might subsume tracing GC when needed.
- eggsnbacon1 6y agoIt definitely doesn't. Rust needs a GC for certain use-cases. I've been hoping for a while that somebody will do a port of Shenandoah or ZGC to Rust. It would be a lot of work but give Rust the best of both worlds