Comment by dbcooper
8 months ago
>Why build a new browser in C++ when safer and more modern languages are available?
>Ladybird started as a component of the SerenityOS hobby project, which only allows C++. The choice of language was not so much a technical decision, but more one of personal convenience. Andreas was most comfortable with C++ when creating SerenityOS, and now we have almost half a million lines of modern C++ to maintain.
>However, now that Ladybird has forked and become its own independent project, all constraints previously imposed by SerenityOS are no longer in effect. We are actively evaluating a number of alternatives and will be adding a mature successor language to the project in the near future. This process is already quite far along, and prototypes exist in multiple languages.
Nice to see. The only thing that would meaningfully set it apart from the others would be to have a core that isn’t a big ball of C++. That would potentially allow it to be developed and maintained with less resource than the other browsers, and that would be the only way this ever reaches any kind of impact.
If I'm not wrong Firefox is already Rust. The language was even created inside Mozilla.
Only around 11% of it is Rust according to https://4e6.github.io/firefox-lang-stats/ , which by the way is no small feat given how huge the code base is.
It is. They realized that writing a modern browser (i.e. one that for example uses multiple cores efficiently by doing layout/rendering/etc in parallel) is almost impossible in C++. To the point where creating a whole new language just to solve the problem would be a smaller undertaking. Which says something about the scope of this problem. And I really do think they are right.
28 replies →
Jakt[0] was being developped by Andreas at some point. It seems stall for now.
[0] https://github.com/SerenityOS/jakt
Will Jakt be used as a C++ replacement long term? Going Rust for Ladybird is probably too far fetched given the sheer amount of C++ code. And also, Jakt seems to solve the memory safety problem while still giving C++ performance.
I kind of hope it stays with C++. C++ has been around for decades and is the gold standard for large performance applications, if they used python like many open source projects I worry it would be too slow, and rust feels like a fad
Let us hope it is not a fad. It is already in the windows kernel, android, and chrome in addition to Firefox. MS, google, and the NSA have all said to stop using languages like c and c++.
So half a million lines of tech debt?
I think that's too pessimistic. The code is there and it can be used to push the project forward. If some part of it is not good enough, then an alternative implementation can be created (potentially in a different language)
A classic: https://www.joelonsoftware.com/2000/04/06/things-you-should-...
>> "The idea that new code is better than old is patently absurd. Old code has been used. It has been tested. Lots of bugs have been found, and they’ve been fixed. There’s nothing wrong with it. It doesn’t acquire bugs just by sitting around on your hard drive."
>> "Each of these bugs took weeks of real-world usage before they were found. The programmer might have spent a couple of days reproducing the bug in the lab and fixing it. If it’s like a lot of bugs, the fix might be one line of code, or it might even be a couple of characters, but a lot of work and time went into those two characters."
>> "When you throw away code and start from scratch, you are throwing away all that knowledge. All those collected bug fixes. Years of programming work."
It's an older piece, but like good old code, it still holds up. Newer tools and technology have improved the creating of new code, but they've also made improving old code easier in equal measure.
9 replies →
Would another language have avoided this?
Nothing but Rust is safe from being attacked by the Rust zealots. It's been extremely annoying these last few years.
1 reply →
If we go by parents definition of “C++==tech debt”, then yes.
Also the web standards themselves are written in an object oriented style. Using a non oo language like rust is therefore an uphill battle where you end up fighing against the language. The web standards just lend themselves naturally to be implemented in an oo language like c++.
?! Rust is roughly equally as OO as C++ is. Which is not surprising given its aim to replace C++.
https://doc.rust-lang.org/book/ch17-00-oop.html
Rust does not make it simple or easy to reference objects from objects. You will be fighting the borrow checker if you try. This is what I mean.
The web standards have lots of references between everything. This type of object oriented programming means having lots and lots of cycles in your object graph. This makes Rust very veeeery unhappy. The Servo people are trying, and they have been trying for a looong time...
2 replies →
True, but the patterns allowed on the web (or in GUIs for that matter) are incredibly painful in Rust.
There was a nice article about the GUI part: https://www.warp.dev/blog/why-is-building-a-ui-in-rust-so-ha...
These points are even more painful with web standards.
I think that pioneering the work of reimplementing web standards in not strictly OOP language will make the implementation easier for anyone else in the future, surely many of the problems exist by virtue of being done for the first time