We’ve been searching for a memory-safe programming language to replace C++ in Ladybird for a while now. We previously explored Swift, but the C++ interop never quite got there, and platform support outside the Apple ecosystem was limited. Rust is a different story. The ecosystem is far more mature for systems programming, and many of our contributors already know the language. Going forward, we are rewriting parts of Ladybird in Rust.

Porting LibJS

I used Claude Code and Codex for the translation. This was human-directed, not autonomous code generation. I decided what to port, in what order, and what the Rust code should look like. It was hundreds of small prompts, steering the agents where things needed to go. After the initial translation, I ran multiple passes of adversarial review, asking different models to analyze the code for mistakes and bad patterns.

  • HubertManne@piefed.social
    link
    fedilink
    English
    arrow-up
    4
    arrow-down
    11
    ·
    12 hours ago

    I came to say this sounds like a good example of how to use ai. Its going to be used but the big problem is folks who will take the output and say good enough.

    • Blisterexe@lemmy.zip
      link
      fedilink
      arrow-up
      4
      arrow-down
      9
      ·
      12 hours ago

      Yeah, using AI to help you rewrite code (which is tedious) in a scenario where there are clear test cases (it either works or it doesn’t) is basically the ideal usecase.

      • gravitas_deficiency@sh.itjust.works
        link
        fedilink
        English
        arrow-up
        11
        arrow-down
        3
        ·
        11 hours ago

        …no… this is a bad idea. Especially in a browser, given the myriad safety and security concerns in play. This is an objectively bad way to make changes to the project. I can just about guarantee they’re going to introduce some horrid subtle flaws.

        • Blisterexe@lemmy.zip
          link
          fedilink
          arrow-up
          5
          ·
          9 hours ago

          I may be misinformed but the article says

          We’ve verified that every AST produced by the Rust parser is identical to the C++ one, and all bytecode generated by the Rust compiler is identical to the C++ compiler’s output.

          which I took to mean that the new code behaves 100% identically to the old code, like a byte-perfect decompilation. If that’s not the case and it’s just the same in their suite of tests then I’d agree with you.

          • Liketearsinrain@lemmy.ml
            link
            fedilink
            arrow-up
            8
            ·
            8 hours ago

            It depends on how extensive (and correct) the tests are, which can be pretty difficult. There is also maintainability of generated code.