Lobsters.

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.

  • Eager Eagle@lemmy.world
    link
    fedilink
    English
    arrow-up
    2
    ·
    1 day ago

    Why it wouldn’t be? Surely not having idiomatic rust doesn’t eliminate other benefits of switching to the language, like better tooling, memory safety, and perhaps more people willing to contribute. Over time the codebase can be improved but the main goal in the transition seems to not break existing functionality, which they seem to have accomplished for LibJS.

    • CameronDev@programming.dev
      link
      fedilink
      English
      arrow-up
      3
      ·
      20 hours ago

      I haven’t looked at the code, but the mem safety may be out if the translation just slapped unsafe and transmute everywhere.

      And “working code” is often very hard to replace, it can be hard to justify code changes when the original “works just the same”. So, I would expect the weird ported code to live on unless there is a major effort to rewrite it.

      • Eager Eagle@lemmy.world
        link
        fedilink
        English
        arrow-up
        2
        ·
        20 hours ago

        There’s no reason to believe it’s mostly unsafe. And even if that’s the case, changing from unsafe rust to safe is less of a leap than cpp to rust.

        • CameronDev@programming.dev
          link
          fedilink
          English
          arrow-up
          2
          ·
          edit-2
          19 hours ago

          Having done some C to rust auto-translation some time ago, it definitely was wildly unsafe. Maybe it’s better now, but there is no reason to assume it’s mostly safe now either. Even recently I did some regular vibe coding to test it out, and it generated some very questionable code.

          Even if there is zero “unsafe”, there could be loads of unchecked array accesses, or unwraps causing panics, which while “safe”, will cause crashes.

          Fixing unsafe can be a mixed bag, some will be easy, some will require much deeper changes. And without looking at the code, impossible to say which it will be.

    • XLE@piefed.social
      link
      fedilink
      English
      arrow-up
      2
      ·
      24 hours ago

      I don’t think “why not” is a great response in general - especially when the same developer also invested time in Swift that was ultimately wasted.

      • Eager Eagle@lemmy.world
        link
        fedilink
        English
        arrow-up
        1
        ·
        24 hours ago

        It’s not a why not response. I’m asking back why do you think it wouldn’t be worth it even as a literal translation from C++, because in my view, that would be a first step towards a proper Rust port, and it still brings benefits to the table.