1. 50

  2. 10

    This is a really exceptional post! I like the amount of detail and the fact that it’s an actual case study of a real C library you might actually want to port to Rust. Kudos to the author.

    Also making a point of adding rust tests that exercise the C code before the real meat of the porting has happened is a good idea - and it’s revealing that doing this revealed a bug in the original C library!

    1. 7

      Carol Nichols also gave a talk about this approach a few years back. In that case the C library was Google’s zopfli tool. https://github.com/carols10cents/rust-out-your-c-talk

      1. 1

        I’ll add that rewrites are another area where it can help to use tools that automatically generate tests from codebases and/or binaries. One might get equivalence tests and ability to port without really even understanding the code. They might just understand it mechanically to fix any incompatibilities.

        Drawback is that’s probably less fun. I imagine learning how things work is part of the motivation for many volunteer porters.

      2. 3

        I think one important thing is missing in this article, namely what RiiR means (it’s rewrite in Rust).

        1. 1

          The second ‘i’ stands for “it”: Rewrite it in Rust.

          It’s a bit of a meme (and not entirely complimentary of the Rust Evangelism Strike Force).