4 ms·
They said some of the code can be rewritten in Rust but majority of the code cannot. Therefore they are stuck with C++ forever. Scary thing to think about.
by mrkramer 2y ago
They said some of the code can be rewritten in Rust but majority of the code cannot. Therefore they are stuck with C++ forever. Scary thing to think about.
- happyweasel 2y agoAlso scary for Rust.
- mdaniel 2y ago> but majority of the code cannot Do you have a citation for "cannot"? Maybe "prefer not because of non-functional requirements" but if it's a choice between a ~~webpage~~ ad vector loading 10 seconds slower versus the goddamn plague of RCEs coming out of Chrome, I know which one I'd take
- mrkramer 2y ago>Over the past decades, in addition to large Java and Go memory-safe codebases, Google has developed and accumulated hundreds of millions of lines of C++ code that is in active use and under active, ongoing development. This very large existing codebase results in significant challenges for a transition to memory safety: We see no realistic path for an evolution of C++ into a language with rigorous memory safety guarantees that include temporal safety. A large-scale rewrite of all existing C++ code into a different, memory-safe language appears very difficult and will likely remain impractical[0]. [0] https://security.googleblog.com/2024/03/secure-by-design-googles-perspective-on.html#:~:text=Over%20the%20past,likely%20remain%20impractical https://security.googleblog.com/2024/03/secure-by-design-goo.... Long story short; they are stuck with millions of C++ LOC and they can't transition to Rust completely because of the enormous complexity of various gigantic codebases e.g. Android, Chrome or whatever they want to move to memory-safe language/s. They said they will try to write as much new native code in Rust as they can plus they will interop from C++ to Rust in order to reduce memory-safety bugs.
- niutech 2y agoCan't they use a transpiler from C++ to Rust? E.g. https://llvm.org/devmtg/2023-05/slides/Posters/02-Preto-AutomaticTranslationCPlusPlus-Rust.pdf https://llvm.org/devmtg/2023-05/slides/Posters/02-Preto-Auto...
- swiftcoder 2y agoEventually, maybe. In the short term, the transpilers mostly translate from other languages into unsafe Rust - which is a helpful tool during porting, but there is still a mountain of work to refactor unsafe idioms into safe before you really reap the benefits.
- niutech 2y agoThe presentation I linked talks about transpiling C++ to safe Rust.
- swiftcoder 2y agoYes, there are a few such efforts ( such as https://arxiv.org/pdf/2401.08264 https://arxiv.org/pdf/2401.08264 ). My understanding is that all are still somewhat experimental.