← Back to context

Comment by Buttons840

5 days ago

Looks interesting, but they're going to try writing it in Swift?

If you're writing a browser engine in C++, I may not like it, but I can see that you're pragmatic and are focused on the end result rather than the language. If you're writing it in Rust, okay, you maybe have your eyes on that pie in the sky, but you've chosen a language that, at least potentially, has the ability to replace C++ in creating bedrock software.

Any other language and I feel like someone with a lot of political capital at the company just has a personal preference for the language and so, "yeah, we're going to rewrite it all in Swift"[0].

I mean, you're writing a browser. Do you really want to build it in a language that is at the "it's improving" stage of support for the most popular operating systems?

[0]: https://x.com/awesomekling/status/1822236888188498031

You should look into why they chose it and what their implementation plan is. They evaluated multiple languages, including rust. There were some specific issues with rust that made it unsuitable for them. Swift was a bit of a dark horse candidate that the developers ended liking.

There is no immediate plan to switch to anything so it’s still C++. They may not ever switch. Swift’s cross platform support isn’t there yet and that’s a prerequisite.

  • I couldn't find any information beyond that Tweet I linked.

    • I'll see if I can find it. I don't remember the specifics on rust, but it sounded like they gave it a fair shot. It was basically the one to beat until they figured out it wasn't going to work. The decision to adopt Swift wasn't made on a whim and, frankly, I'm skeptical it will happen any time soon, if ever. I think it's one of those situations where they want to make it more accessible to a next generation of developers the same way Linux is adopting rust. Swift is actually a really nice language, despite being associated primarily with Apple. It would be cool to see higher adoption.

      Ladybird has an interesting way of documenting web standards in code. They put a link to the reference doc at the top of a function and then each rule in a comment where it is implemented. It's very easy to follow and good quality code. Another project I recall having high quality code was KHTML. Not coincidentally, Andreas Kling worked on that one too.

      There are examples here: https://github.com/LadybirdBrowser/ladybird/tree/master/Libr...

      Anyway, the point is what they are doing is working well and Swift won't be ready for a while. If it ever happens, it won't be a rewrite. It'll more likely be a situation where it's written in both the same way Linux is both C and rust.

      5 replies →

    • Andreas has said that in some video I watched at some point, can't pinpoint it, but I can confirm jm4 didn't make it up