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
 

I'm not a programmer (or just a beginner one)
So just wanted to know if it is possible and will happen in the near future. Isn't C/C++ decades old and has some good amount of limitations?

you are viewing a single comment's thread
view the rest of the comments
[–] dressupgeekout@lemmy.ml 7 points 2 years ago (1 children)

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.

[–] dressupgeekout@lemmy.ml 2 points 2 years ago (1 children)

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.

[–] pingveno@lemmy.ml 3 points 2 years ago (2 children)

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.

[–] ksynwa@lemmygrad.ml 2 points 2 years ago (1 children)

Isn't rust adoption pretty good already. Earlier it only had a large base of opinionated groupies but a lot of corporations are using it now.

[–] pingveno@lemmy.ml 3 points 2 years ago

It's certainly getting some use in industry, yes. There are also some efforts to teach it in higher ed, first as more of an elective and then maybe replacing C/C++ in the intro courses. However, I think it will take a while to gain traction. Take the situation on my team. I would love to use Rust for a project, but that's reliant on someone else learning Rust.

On the academic side of things, we have a professor involved with Rust Edu. He's been teaching a Rust Programming course for a few years now, but he's looking down the road a few years. The instructor who teaches the intro classes will retire eventually, so that would be a natural transition point. It's these human and institutional factors that play a larger role at this point.

[–] pitbuster@lemmy.ml 1 points 2 years ago (1 children)

Go is much closer to Java

Also Go's compiler and type system are terrible for a modern language.

[–] pingveno@lemmy.ml 1 points 2 years ago

That seems to have been more a matter of taste for its designers, so I wasn't going to use it as criticism.