Live data from Hacker News

Ladybird adopts Rust, with help from AI

ladybird.org

611–620 of 731 posts

Re: Ladybird adopts Rust, with help from AI

#611

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?

The impression I get from the article is not that the compiled code of each implementation produces the same object code, but that when the implementations are run with the same inputs, they produce exactly the same output — that is, the same JS VM bytecode.

Re: Ladybird adopts Rust, with help from AI

#612
post #507

Earlier 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.

I've seen more than a few rewrite attempts fail throughout the years. However, I've never seen a direct language to language translation fail. I've done several of these personally: from perl to ruby, java to kotlin, etc.

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

#613

I'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.

Definetly, thats how I have felt about and used C++ for most of my career. ( well except I dont select C++ for personal projects).

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

#615

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?

I've looked at the code from the PR. It seems to use safe types and standard idioms like pattern matching, so at least at first glance it looks like Rust.

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

#616
Lol this dude is incapable of finishing anything he starts. Always a million distractions. First he started an OS called Serenity, then abandoned that to start a programming language (Jank or something) then abandoned that to work on a web browser, now it's looking like he is looking for things to distract away from that... A shame really.

Re: Ladybird adopts Rust, with help from AI

#617

Earlier 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 don't think they actually care if it ever materializes. They just have to sell execs on it. As long as they can the exec will sell it to their higher ups, mostly by just flat out lying about it.

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

#618

Earlier 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.

this

tho duplicated crates with different major versions through transitive deps is also i believe possible

Re: Ladybird adopts Rust, with help from AI

#619

Earlier 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.

you have to ask it to profile and optimize the code for you. Then have it document the changes and run it in a loop. It’ll do wonders.

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.

Post reply on HN