3 ms·
Speaking by example: If you have one team of 10 people write a browser engine in C++ and another team of 10 people write the same browser engine in safe Rust (
by Dig1t 5y ago
Speaking by example:
If you have one team of 10 people write a browser engine in C++ and another team of 10 people write the same browser engine in safe Rust (or as much safe rust as you can get away with), over a 5 year timespan you'll discover fewer UAF bugs in the Rust-written engine than the C++ one.
This is the value prop for any company deciding to use Rust. Obviously every language comes with tradeoffs, but this is concretely what people mean when they throw around the word "safety".
The author is also totally correct in pointing out how easy it is to include unsafe Rust in your code by linking unsafe crates. I think this should definitely be an area of discussion and awareness-raising on the part of developers.
- zozbot234 5y ago> I think this should definitely be an area of discussion and awareness-raising on the part of developers. It is. There is an unofficial `cargo geiger` tool that will alert you to these issues.
- nlitened 5y ago> If you have one team of 10 people write a browser engine in C++ and another team of 10 people write the same browser engine in safe Rust Has it ever been shown that it’s possible to write a full browser engine in Rust? I believe for C++ it has been proven multiple times. If I am not mistaken, Servo hasn’t been finished in 10 years.
- leshow 5y ago> Servo hasn’t been finished in 10 years. Mozilla laid off all their servo developers in 2020 > Has it ever been shown that it’s possible to write a full browser engine in Rust? Why wouldn't it be possible?
- nlitened 5y ago> Mozilla laid off all their servo developers in 2020 Yeah, I know, that’s sad. > Why wouldn't it be possible? I don’t know if it’s possible in reality or not, but if I have to, I can imagine some reasons (I’m making them up): maybe it takes too long to write proper safe Rust, or maybe developers get stuck bikeshedding over use of language features, or maybe the language’s learning curve is too steep, or maybe compilation is too long for fast dev iterations, or maybe developers who like Rust don’t like large codebases, or maybe Rust does not provide any tangible benefits over already existing code, or any combination of reasons. Of course, you can write any program in any general-purpose language, just not everything is practical to be ever made. Like, I doubt people will make a full browser engine in Python, although it’s possible in theory.
- pritambaral 5y ago> I can imagine some reasons (I’m making them up): ... All your listed reasons apply equally (or even more strongly) to C++.
- nlitened 5y agoMy point is, these reasons obviously didn’t hinder a possibility of making a full browser engine in C++ multiple independent times. But for Rust — they might be too big of an obstacle to make one. (Original discussion was about comparing quality of browser engines written in C++ and in Rust)
- leshow 5y agoKeep in mind Rust wasn't even 1.0 until 2015, so servo was being developed in tandem with that, from 2015 to 2020 they integrated stylo from servo to firefox, and a few other components if memory serves. So no, I guess they didn't bring an entire re-write to market in that time, but I don't think you can attribute any of those failings to language choice.