Pardon my ignorance, but doesn't a byte-by-byte output recreation of the C++ code in Rust defeat the whole purpose of using Rust? For one, would it be idiomatic Rust anymore? Also, if there's a (non-memory related) vulnerability in the C++ code, would it be possible for that to be introduced in Rust too?
Ladybird adopts Rust, with help from AI
611–620 of 731 posts
Re: Ladybird adopts Rust, with help from AI
#612Earlier quoted context omitted.
One of the biggest point of rewriting is you know better by then so you create something better. This is a HUUUGE reason code written in rust tended to be so much better than the original (which was probably written in c++). Human expertise is the single most important factor and is more important than language. Copy pasting from one language to another is way worse than complete rewrite with actual idiomatic and use…
> Copy pasting from one language to another is way worse than complete rewrite with actual idiomatic and useful code. But translating with automated tools is a much faster experiment. Sometimes (not always), rewriting from scratch ends up in a big loss of time and resources and never replaces the old version.
Step 1 of any rewrite of a non-trivial codebase should should be parity. You can always refactor to make things more idiomatic in a later phase.
Re: Ladybird adopts Rust, with help from AI
#613I'm a long-time Rust fan and have no idea how to respond. I think I need a lot more info about this migration, especially since Ladybird devs have been very vocal about being "anti-rust" (I guess more anti-hype, where Rust was the hype). I don't know if it's a good fit. Not because they're writing a browser engine in Rust (good), but because Ladybird praises CPP/Swift currently and have no idea what the contributor's…
Its possible to dislike Rust but pragmatically use it. Personally, I do not like Rust, but it is the best available choice for some work and personal stuff.
I wouldnt go as far as to say, I dont like Rust, but it doesnt come natural to me like many other languages do after several decades of experience.
Re: Ladybird adopts Rust, with help from AI
#614I've translated it from Rust to V in 45 minutes. Works great:
https://github.com/medvednikov/libjs_v
Compiles in 0.2 seconds on my M5 (compared to Rust's 3.3 seconds).
Re: Ladybird adopts Rust, with help from AI
#615Pardon my ignorance, but doesn't a byte-by-byte output recreation of the C++ code in Rust defeat the whole purpose of using Rust? For one, would it be idiomatic Rust anymore? Also, if there's a (non-memory related) vulnerability in the C++ code, would it be possible for that to be introduced in Rust too?
It could have been worse. C++ code naively converted line-by-line to Rust typically results in weird and unsafe Rust, but in this case it seems they've only been strict about the results being the same, not the structure of the implementation.
Rewrites have a very high risk of introducing regressions. Trying to fix bugs while rewriting will only make things harder, because instead of simply comparing outputs exactly, you'll have to judge which output is the right one. If you let the behavior significantly diverge during the rewrite, you'll just have two differently buggy codebases and no reference to follow.
It's much easier to make a bug-for-bug compatible copy, and fix bugs later.
Re: Ladybird adopts Rust, with help from AI
#616Re: Ladybird adopts Rust, with help from AI
#617Earlier quoted context omitted.
We keep seeing this pattern over and over as well. Despite LLM companies' almost tangible desperation to show that they can replace software engineers, the real value comes from domain experts using the tools to enhance what they're already good at.
I'd guess this is a bet on which market is more lucrative: * domain experts paying for tooling that will enhance their productivity * capital/management class hoping to significantly replace domain experts Software devs have been a famously tough market to sell tools to for a long time, so the better bet is B. Plus, the story on B is fantastic for fundraising; if there's a 10% chance that it checks out, you want some…
I see it all the time at the Director and VP level. Once big money is on the line, there are no failures, just "opportunities for strategic realignment"
Re: Ladybird adopts Rust, with help from AI
#618Earlier quoted context omitted.
> often with duplicated functionality (multiple Base64, rand, sha256, etc crates) I don’t think this is true unless they differ in major versions no? Cargo will apply semantic versioning and pick the best available given the cargo.toml version constraints.
I don't think they mean multiple versions of the same crate (although can certainly happen too), but rather multiple different crates that cover the same functionality.
tho duplicated crates with different major versions through transitive deps is also i believe possible
Re: Ladybird adopts Rust, with help from AI
#619Earlier quoted context omitted.
Same here. I had Claude write me a web based RSS feed reader in Rust. It has some minor glitches I still need to iron out, but it works great, is fast as can be, and is easy on the eyes. https://github.com/AdrianVollmer/FluxFeed
Re "is fast as can be": in my experience generating C/Zig code via Codex, agent generated code is usually several multiples slower than hand optimized code.
I asked a cursor agent to do the same for a geotiff to pmtiles converter. It managed to optimize the performance from tens of days to half a day for the case I wanted to solve.