Remix.run Logo
nicoburns 8 hours ago

It doesn't have to all-or-nothing. Firefox has been a mixed C++ and Rust codebase for years now. It isn't like the code is written twice. The C++ components are written in C++, and the Rust components are written in Rust.

I suspect that'll also be what happens here. And if the use of Rust is successful, then over time more components may switch over to Rust. But each component will only ever be in one language at a time.

fabrice_d 6 hours ago | parent | next [-]

You can't compare the choices made to evolve a >20 years old codebase with a brand new one. Firefox also as Rust support for XPCOM components, so you can use and write them in Rust without manual FFI (this comes with some baggage of course).

The Ladybird devs painted themselves in a corner when choosing C++ for a new web browser, with many anti-Rust folks claiming that "modern C++ was safe". Well...

LeFantome 5 hours ago | parent | next [-]

> The Ladybird devs painted themselves in a corner when choosing C++ for a new web browser

That choice was never made. C++ was selrcted as the language of choice for SerenityOS. Since the goal of the OS was to make its founder happy, and C++ was his faviourite language at the time, that seems like an obvious choice. Later, as part of SerenityOS, there was a need for an HTML parser. It was written in C++ as was the rest of the operating system. Then that HTML parser evolved into a full web browser. As part of the SerenityOS project, that browser was written completely in C++. Then that web browser forked off into an independent project...

Ladybird was already a fully functioning browser (not finished of course but complete enough to surf many web pages) when it was forked from SerenityOS to create a stand-alone web browser. The choice at that point was "keep evolving the current C++ code base" or start-over. I doubt the second option was even considered.

They have been evaluating other languages since before the fork. Rust was evaluated and rejectd early-on. They even created their own language at one point. https://github.com/SerenityOS/jakt

nicoburns 2 hours ago | parent | prev [-]

> The Ladybird devs painted themselves in a corner when choosing C++ for a new web browser, with many anti-Rust folks claiming that "modern C++ was safe". Well...

Perhaps, but in fairness the project was started in 2018 when Rust was still new and unproven.

> You can't compare the choices made to evolve a >20 years old codebase with a brand new one.

I guess not, but I'm pretty optimistic about Ladybird's ability to adopt Rust if they want to. It's a much smaller codebase than Firefox (~650K LoC).

This initial PR is already ~25k LoC, so approximately 4% of the codebase. It took 1 person 2 weeks to complete. If you extrapolate from that, it would take 1 person-year to port the whole thing, which is not so bad considering that you could spread that work out over multiple years and multiple people.

And Firefox has shown that the intermediate state where you have a mix of languages is viable over the long term, even in a much larger and more complex codebase.

fabrice_d 21 minutes ago | parent [-]

> Perhaps, but in fairness the project was started in 2018 when Rust was still new and unproven.

Rust was already proven in 2018, and I'm pretty sure they went with C++ for other reasons.

VoxPelli 6 hours ago | parent | prev [-]

Firefox was special in that Mozilla created Rust to build Servo and then backported parts of Servo to Firefox and ultimately stopped building Servo.

Thankfully Servo has picked up speed again and if one wants a Rust based browser engine what better choice than the one the language was built to enable?

https://servo.org/

nicoburns 2 hours ago | parent [-]

As a Servo contributor, I am aware of Servo :)

But I'm also cheering along Ladybird's progress. There's definitely room for more than one project in the space. And IMO the more browsers being built in Rust in the better.