1. 4
  1. 4

    Every single C/C++ project without exception should consider rewriting their project in Rust, or at least introducing Rust code to the project gradually with the aim of eventually replacing all C/C++ code. This includes the linux kernel, the nix package manger, and any other C/C++ project named in that article. (Of course, there are good reasons why such a rewrite might not be tractable for any given software project, but the possibility should at least be on the maintainers’ radar).

    This isn’t so much because Rust is a good language, but because C and C++ are poor ones. C is a 50 year old programming language written and standardized before the programming profession had come to learn a lot about what make a programming language nice to program in (and subject to what sort of compiler you could write easily on a 1970s computer). C++ is a bunch of kludges on top of C that are difficult for any one person to fully understand. More importantly, these languages make it very easy to write code with memory safety bugs, and using software with memory safety bugs no one knows about leads to security vulnerabilities that affect the people running that software. If it were possible I would love to not execute a single line of code on my computer compiled from C source, but that is not practical right now.

    Rust is obviously a particularly good choice of language to replace C/C++ with - it’s a GC-less systems language, and it can link to existing C code easily, making it tractable to port code from C to Rust piece-by-piece - as well as being a generally well-designed, modern language with good tooling and a good developer experience. But there’s nothing inherently special about Rust. If you could rewrite a given C program in Java, or Python, or Javascript, that would be nearly as useful (I do think Rust has a better static typing story than any of these languages and that this matters for program correctness). If someone invented a new language tomorrow that had similar memory-safety and C-interoperability guarantees as Rust but was otherwise completely different, rewriting C/C++ programs in this new language would also be a good thing to do.

    1. 1

      I’m not sure if you’ve read TFA or not, but it specifically calls out the behavior by non-contributors to request projects undergo a “Rewrite it in Rust”, and how it can be both amusing and problematic.

    Stories with similar links:

    1. Have you considered Rewriting It In Rust? via jturner 5 years ago | 27 points | 40 comments