Comment on Ladybird Browser adopts Rust, with help from AI
eager_eagle@lemmy.world 16 hours agoout of context?
Please coordinate with us before starting any porting work so nobody wastes their time on something we can’t merge.
If you look at the code, you’ll notice it has a strong “translated from C++” vibe. That’s because it is translated from C++. The top priority for this first pass is compatibility with our C++ pipeline. The Rust code intentionally mimics things like the C++ register allocation patterns so that the two compilers produce identical bytecode.
that seems reasonable to me
XLE@piefed.social 16 hours ago
But is it a good idea to just translate something from C++ like that? It seems technically feasible but there’s something “off” about the whole thing.
Like the developer originally talked about switching to Swift, then decided not to switch to Swift.
And previously, “Ladybird devs have been very vocal about being ‘anti-rust’ (I guess more anti-hype, where Rust was the hype).”
Apparently you can translate C++ directly to Rust, but anecdotal statements claim that while Rust supports C++ conventions, you wouldn’t typically build a Rust app using them.
It all just suggests rudderlessness from the developers right now.
eager_eagle@lemmy.world 15 hours 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 9 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 9 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.
XLE@piefed.social 13 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 13 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.