this post was submitted on 27 Jan 2024
37 points (97.4% liked)

Rust

6013 readers
4 users here now

Welcome to the Rust community! This is a place to discuss about the Rust programming language.

Wormhole

[email protected]

Credits

  • The icon is a modified version of the official rust logo (changing the colors to a gradient and black background)

founded 1 year ago
MODERATORS
37
Rust in thunderbird (thunderbird.topicbox.com)
submitted 9 months ago by [email protected] to c/rust
top 5 comments
sorted by: hot top controversial new old
[–] technom 10 points 9 months ago (4 children)

Choosing Rust instead of C or C++ for new projects is a rather light decision. But introducing it into or outright replacing legacy codebase with it is a rather phenomenal undertaking. Fish shell was completely rewritten. Linux is introducing it in no trivial way. I wonder if the woes with C/C++ is that bad.

[–] snaggen 6 points 9 months ago

Librsvg did the rewrite incrementally, so you can choose to only use rust for new code in an existing codebase.

[–] [email protected] 5 points 9 months ago* (last edited 9 months ago)

Fish was rewritten for a different reason. Essentially, fish wanted to do more with threads, and making something that worked well was going to involve a large amount of work to ensure it was safe and correct (you don't want data races in your shell). The main dev and a lot of the contributors were already familiar with Rust, so it made a lot of sense.

And so far, Linux seems to be taking it really slowly. There are drivers in Rust, as well as an optional scheduler. The main language for kernel development is still C.

Rust may not be the best option for all projects, but it can be integrated in with minimal disruption if projects do find value with it.

[–] LeFantome 5 points 9 months ago

Other than having to know Rust, adding Rust to a C code base is not difficult. They play well together.

There is no need to rewrite old code but, once Rust is there, you are free to.

Linux is a bit of a special case as you cannot just blindly use the Rust standard library.

Having to have a Rust tool chain to build with may or may not be an issue.

For some use cases, like BSD or the Linux kernel, platform support is also a consideration.

[–] [email protected] 3 points 9 months ago

For me the biggest issue is all the undefined behaviour and unsafe memory.

Taking a look at libraries everyone uses where there are unsafe memory issues for years until someone finds them shows this quite nicely.