this post was submitted on 09 Sep 2022
7 points (100.0% liked)
Rust Programming
8134 readers
4 users here now
founded 5 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
C is "old," sure, but not at all antiquated. So much important, infrastructural software continues to be written in C to this very day. It's never going away. It's not smart to replace/rewrite all software written in C with something else just for the sake of using a "newer" or "modern" language. The most popular C and C++ compilers today are actively maintained and SUPER advanced, having been based on 40+ years of experimentation and experience!
Also, there is a C compiler for, like, almost literally every CPU instruction set ever created. Currently, Rust compilers do target an admirable set of platforms, but it will NEVER be on par with the set of computers you can program for in C. And for many applications, Rust simply is not an option. Especially in embedded and industrial settings, where huge changes raise more questions than answers them, and where adopting new technologies is super slow on purpose because stuff HAS to work and interruptions are not tolerated. Lots of trepidation in a factory, or in avionics hardware and other critical stuff like that -- less so in someone's desktop PC.
It's far easier to port C, in general. When new platforms, new instruction sets inevitably come around, it will be a C compiler which will be written for it first -- purely because of how straightforward the language is, how it was designed from the beginning to be easy to translate into assembly. So, while the design of Rust and its compilers may have some cool and compelling features, it is (in my view) always more expedient (and therefore smarter?) to hit the ground running with a new platform with a C compiler first.
TL;DR there will always be a place for C and C++. There never won't be, from a practical perspective, because it is utterly ubiquitous. I'm sure Rust will succeed, but it cannot displace C/C++, because nothing can.
Also consider: people praise Rust's commitment to memory safety. And there have been some devastating, high-profile bugs in recent memory that were caused by memory leaks in a C library or whatever.
You could blame C for those disasters, if you like -- OR you could recognize that it is so much more practical to fix memory leaks in a C/C++ program than it is to uproot the whole thing and rewrite in Rust, or switch whatever you're working on to a Rust-centric universe.
That alone accounts for a lot of the inertia which slows down the super-wide adoption of Rust, I'd wager.
I'm going to take a different stance. I think that Rust has a high likelihood of eventually replacing C/C++, but an extremely low likelihood of doing so in the near to medium future. For new systems applications, we currently are seeing a few companies asking whether Rust is the right tool for them and some going with it. I see that as been the case for the next maybe decade. As time goes on, I think there will be a shift. At some point, the three languages will be seen more as equals instead of Rust as being immature and risky. Then I think there will be a tipping point where instead of people asking "Why Rust?", they will ask "Why not Rust?"
The reason I think this is simple. C especially is truly the root of many problems in modern computing, security and otherwise. 50 years of "just be more careful" hasn't fixed it. We've seen the world that creates, and it's a world full of bugs and shitty software. Momentum can only be held so long by C/C++ when they have a credible competitor nipping at their heals. That hasn't been the case for most of their lifetime. Java is not a true systems language, D's GC-free ecosystem doesn't exist, and Go is much closer to Java. Besides just lifetimes and division of safe/unsafe code, Rust also brings many quality of life improvements. There's no more casting void pointers out of the custom hash map you implemented for the hundredth time.
Also Go's compiler and type system are terrible for a modern language.
That seems to have been more a matter of taste for its designers, so I wasn't going to use it as criticism.