19 ms·
Ladybird adopts Rust, with help from AI
- viktorcode 8mo ago> We previously explored Swift, but the C++ interop never quite got there But Rust doesn't have C++ interop at all?
- k33n 8mo agoIt's technically Rust -> C -> C++ as it stands right now
- tonyedgecombe 8mo ago>But Rust doesn't have C++ interop at all? It also doesn't have the disadvantages of Swift. Once the promise of Swift/C++ interop is gone there isn't enough left to recommend it.
- skavi 8mo agoI’m curious what issues people were running into with Swift’s built in C++ interop? I haven’t had the chance to use it myself, but it seemed reasonable to me at a surface level.
- stratos123 8mo agoThere's a list of unsolved problems in this Ladybird issue, now closed because they dropped Swift: https://github.com/LadybirdBrowser/ladybird/issues/933 https://github.com/LadybirdBrowser/ladybird/issues/933 for example: "Swift fails to import clang modules with #include <math.h> with libstdc++-15 installed. Workaround: None (!!)"
- nicoburns 8mo agoYou can do it via the C ABI, and use opaque pointers to represent higher-level Rust/C++ concepts if you want to. Firefox is a mixed C++ / Rust codebase with a relatively close coupling between Rust and C++ components in places (layout/dom/script are in C++ while style is in Rust, and a mix of WebRender (Rust) and Skia (C++) are used for rendering with C++ glue code)
- wavemode 8mo ago> You can do it via the C ABI, and use opaque pointers to represent higher-level Rust/C++ concepts Yeah but, you can do the same in Swift
- nicoburns 8mo agoMy understanding from a brief read of the Swift issue is that they kept running into bugs in the Swift compiler which, in practice, prevented them from doing the things that they ought to be do in theory. This went on for long enough, that they got fed up and abandoned Swift. The Rust compiler is incredibly solid (across all target platforms), and while it's C/C++ interop is relatively simplistic, what does exist is extensively battle tested in production codebases.
- azornathogron 8mo agoIt may have in the future. Crubit is one effort in this direction: https://crubit.rs/ https://crubit.rs/
- woadwarrior01 8mo agoYeah, that part doesn't make much sense to me. IMO, Swift has reasonably good C++ interop[1] and Swift's C interop has also significantly improved[2] since Swift 6.2. [1]: https://www.swift.org/documentation/cxx-interop/ https://www.swift.org/documentation/cxx-interop/ [2]: https://www.swift.org/blog/improving-usability-of-c-libraries-in-swift/ https://www.swift.org/blog/improving-usability-of-c-librarie...
- matthewkosarek 8mo agoThere is also cxx.rs, which is quite nice, albeit you have to struggle sending `std` types back and forth a bit
- nicoburns 8mo ago> albeit you have to struggle sending `std` types back and forth a bit Firefox solves this partly by not using `std` types. For example, https://github.com/mozilla/thin-vec https://github.com/mozilla/thin-vec exists in large part because it's compatible with Firefox's existing C++ Vec/Array implementation (with the bonus that it's only 8 bytes on the stack compared to 24 for the std Vec).
- nickorlow 8mo agoLuckily, ladybird also does not use `std` types
- the_mitsuhiko 8mo agoRust has cxx which I would argue is "good enough" for most use cases. At least all C++ use cases I have. Not perfect, but pretty damn reasonable.
- mosura 8mo agoInterestingly editorialized title omits “with help from AI”.
- supriyo-biswas 8mo agoA LLM-assisted codebase migration is perhaps one of the better use cases for them, and interestingly the author advocates for a hands-on approach. Adding the "with help from AI" almost always devolves the discussion from that to "developers must adopt AI or else!" on the one hand and "society is being destroyed by slop!" on the other, so as long as that's not happening I'm not complaining about the editorialized title.
- alpinisme 8mo agoThat’s probably just the classic HackerNews title shortening algorithm at work.
- throwaway2037 8mo ago> classic HackerNews title shortening algorithm Woah, this is a wild claim. @dang: Is this a thing? I don't believe it. I, myself, have submitted many articles and never once did I see some auto-magical "title shortening algorithm" at work!
- logicprog 8mo agoI've seen it happen a couple times, iirc, it removes things after commas, and removes certain words as well
- ivanjermakov 8mo agoAdds [video] to YouTube links, too.
- simlevesque 8mo agoIt's been confirmed by @dang many times before. I'm not sure if that's what cut the title here but I've seen it many times in the last 10 years.
- throwaway2027 8mo agoI guess the ETA will pushed back by a few years then?
- FpUser 8mo agoProbably not unless using Rust present some particular challenge for this type of project. But having eaten this proverbial apple they would probably use AI more and more assuming they have a budget and in this case being less rich than C++ might not mean much for productivity
- OtomotO 8mo agoBy 2 weeks so far ;-)
- VMG 8mo agodevelopers with good taste like Andreas Kling will be able to design entire OSes with coding agents
- embedding-shape 8mo agoYeah, some weekends ago I tried writing a cross-platform browser without any Rust crates, this weekend I made my own self-hosted compile to Rust Clojure-like lisp, maybe next weekend attempting to create a OS that uses my language to run on bare-metal would actually be a challenge. Thanks for the inspiration :)
- Vsreddyh 8mo agoHe already did
- vdupras 8mo agoThis comment raises an interesting question: Would Serenity OS have brought Andreas the same kind of serenity had it been developed with AI? Open candid question.
- Imustaskforhelp 8mo agoI don't think so because if I remember it correctly, Andreas suffered from alcoholism and serenity prayer helped him to go on the right path and iirc he honored that and created an os named serenityos. God grant me the serenity to accept the things I cannot change; courage to change the things I can; and wisdom to know the difference. (courage to change the things I can;):- I think that this line must've given Andreas the strength, the passion to make the project reality. but if AI made the change. Would the line be changed to courage to prompt an all powerful entity to change the things I asked it to. Would that give courage? Would that inspire confidence in oneself? I have personally made many projects with LLM's (honestly I must admit that I am a teenager and so I have been sort of using it from the start) and personally, I feel like there are some points of curiosity that I can be prideful of in my projects but there is still a sense of emptiness and I think I am not the only one who observes it as such. I think in the world of AI hype, it takes true courage & passion to write by hand. Obviously one tries to argue that AI is the next bytecode but that is false because of the non deterministic nature of AI but even that being said, I think I personally feel as if the people who write assembly are definitely likely to be more passionate of their craft than Nodejs (and I would consider myself a nodejs guy and there's still passion but still) Coding was definitely a form of art/expression/sense-of-meaning for Mr Andreas during a time of struggle. To automate that might strip him of the joy derived from stroking brush on an empty canvas. Honestly, I really don't know about AI the more I think about it so I will not pretend that I know a thing/two about AI. This message is just my opinion in the moment. Opinions change with time but my opinion right now is that coding by hand definitely is more meaningful than not if the purpose of the project is to derive meaning.
- qudat 8mo ago> We know the result isn’t idiomatic Rust, and there’s a lot that can be simplified once we’re comfortable retiring the C++ pipeline. That cleanup will come in time. Correct me if I’m wrong since I don’t know these two languages, but like some other languages, doing things the idiomatic way could be dramatically different. Is “cleanup” doing a lot of heavy lifting here? Could that also mean another complete rewrite from scratch? A startup switching languages after years of development is usually a big red flag. “We are rewriting it in X” posts always preceded “We are shutting down”. I wish them luck though!
- samiv 8mo agoThis is the famous trap that Joel on Software talked about in a blog post long time ago. If you do a rewrite you essentially put everything else on halt while rewriting. If you keep doing feature dev on the old while another "tiger team" is doing the rewrite port then these two teams are essentially in a race against each other and the port will likely never catch up. (Depending on relative velocities) Maybe they think that they can to this LLM assisted tools in a big bang approach quickly and then continue from there without spending too much time on it.
- JumpCrisscross 8mo ago> then these two teams are essentially in a race against each other and the port will likely never catch up Ladybird appears to have the discipline to have recognized this: “[Rust] is not becoming the main focus of the project. We will continue developing the engine in C++, and porting subsystems to Rust will be a sidetrack that runs for a long time.”
- safercplusplus 8mo agoAnd I might suggest that there's the possibility that the C++ code could end up being more cleanly ported to a memory-safe subset of C++. plug: https://github.com/duneroadrunner/scpptool/blob/master/approach_to_lifetime_safety_summary.md https://github.com/duneroadrunner/scpptool/blob/master/appro...
- 8mo ago
- candiddevmike 8mo ago[flagged]
- laserbeam 8mo agoLadybird has a strong "all dependencies built in house" philosophy. Their argument is they want an alternative implementation to whatever is used by other browsers. I'd argue they would never use a third party library like servo as a principle.
- deleted 8mo ago[deleted]
- stephen_g 8mo agoNo they don’t - SerenityOS did, but when Ladybird split out they started using all sorts of third party libraries for image decoding, network, etc. Now a core part of the browser rendering engine is not something they’re going to outsource because it would defeat the goal of the project, but they have a far different policy to dependencies now than it used to before.
- mythz 8mo agoServo isn't a JS engine. Do you mean why didn't they abandon their mission statement of developing a truly independent browser engine from scratch, abandon their C++ code base they spent the last 5 years building, accept a regression hit on WPT test coverage, so they can start hacking on a completely different complex foreign code-base they have no experience in, that another team is already developing?
- noirscape 8mo agoWell for one, Servo isn't just JavaScript, it's an entire engine. Closer to Blink & Gecko. Secondly, Ladybird wants to be a fourth implementor in the web browsers we have today. Right now there's pretty much three browser engines: Blink, Gecko and WebKit (or alternatively, every browser is either Chrome, Firefox or Safari). Ladybird wants to be the fourth engine and browser in that list. Servo also wants to be the fourth engine in that list, although the original goal was to remove Gecko and replace it with Servo (which effectively wouldn't change the fact there's only three browsers/three engines). Then Mozilla lost track of what it was doing[0] and discarded the entire Servo team. Nowadays Servo isn't part of Mozilla anymore, but they're clearly much more strapped for resources and don't seem to be too interested in setting up all the work to make a Servo-based browser. The question of "why not use Servo" kinda has the same tone as "why are people contributing to BSD, can't they just use Linux?". It's a different tool that happens to be in the same category. [0]: Or in a less positive sense, went evil.
- aero-glide2 8mo agoSigh agents keep killing all the passion I have for programming. It can do things way faster than me, and better than me in some cases. Soon it will do everything better and faster than me.
- apples_oranges 8mo agoIt automates both the fun and the boring parts equally well. Now the job is like opening a box of legos and they fall out and then auto-assemble themselves into whatever we want..
- close04 8mo agoRather like opening a box of legos and reading them the instruction sheet while they auto assemble based on what they understood. Then you re-read and clarify where the assembly went wrong. Many times, if needed.
- airstrike 8mo agoNot sure why you'd get that from this post, which says it required careful small prompts over the course of weeks. In the hands of experienced devs, AI increases coding speed with minimal impact to quality. That's your differentiator.
- throwaway2027 8mo agoIt's the opposite for me, most of the time it's first rough pass it generates is awful and if you don't have good taste and a solid background of years of experience programming you won't notice it and I keep having to tell it to steer into better design choices.
- supriyo-biswas 8mo agoIs a migration from language X to Y or refactoring from pattern A to B really the kind of task that makes you look forward to your day when you wake up? Personally my sweet spot for LLM usage is for such tasks, and they can do a much better job unpacking the prompt and getting it done quickly. In fact, there's a few codebases at my workplace that are quite shit, and I'm looking forward to make my proposal to refactor these. Prior to LLMs, I'm sure I'd have been laughed off, but now it's much more practical to achieve this.
- skerit 8mo ago> I used Claude Code and Codex for the translation. This was human-directed, not autonomous code generation. I decided what to port, in what order, and what the Rust code should look like. It was hundreds of small prompts, steering the agents where things needed to go. After the initial translation, I ran multiple passes of adversarial review, asking different models to analyze the code for mistakes and bad patterns. > The requirement from the start was byte-for-byte identical output from both pipelines. The result was about 25,000 lines of Rust, and the entire port took about two weeks. The same work would have taken me multiple months to do by hand. We’ve verified that every AST produced by the Rust parser is identical to the C++ one, and all bytecode generated by the Rust compiler is identical to the C++ compiler’s output. Zero regressions across the board This is the way. Coding assistants are also really great at porting from one language to the other, especially if you have existing tests.
- giancarlostoro 8mo agoThis is also how some of us use Claude despite what the haters say. You dont just go “build thing” you architect, review, refine, test and build.
- gnfargbl 8mo agoIt's how most of us are actually going to end up using AI agents for the foreseeable future, perhaps with increasing degrees of abstraction as we move to a teams-of-agents model. The industry hasn't come up with a simple meme-format term to explain this workflow pattern yet, so people aren't excited about it. But don't worry, we'll surely have a bullshit term for it soon, and managers everywhere will be excited. In the meantime, we can just continue doing work with these new tools.
- card_zero 8mo agoThis is an opportunity to select some stupid words that you would like to hear repeated a million times. The process is like patiently nurturing a well-contained thing, so how about "egg coding"?
- ocd 8mo agoI am unsure if I can rationally justify saying this, but I am left with disappointment and unease. Comparable to when a series I care about changes showrunner and jumps the shark.
- OtomotO 8mo agoMaybe you're part of an anti-cult-cult? Would be as bad as being in a cult.
- nz 8mo agoHate to tell you this, but it's cults all the way down. Plato understood this, and his disdain for caves and wall-shadows, is really a disdain for cults. The thing is, over the last 2300 years, we have gotten really good at making our caves super cozy -- much cozier than the "real world" could ever be. Our wall-shadows have become theme parks, broadway theaters, VR headsets, youtube videos, books, entire cities even. In Plato's day, it made sense to question the cave, to be suspicious of it. But today, the cave is not just at parity with reality, it is superior to it (similar to how a video game is a precisely engineered experience, one that never has too little signal and never has too much noise, the perfect balance to keep you interested and engaged). I'm no mind reader, and certainly no anthropologist, but I suspect that what separates humans from other (non extinct) animals, is that we compulsively seek caves that we can decorate with moving shadows and static symbols. We even found a series of prime numbers (sequences of dots, ". ... ..... .......") in a cave from the _ice age_. Mathematics before writing. We seek to project what we see with our mind's eye into the world itself, thereby making it communicable, shareable. Ever tell someone you had a dream, and they believed you? You just planted the seed for a cult, a shared cave. Even though you cannot photograph the dream, or offer any evidence that you can dream at all. The industrial and scientific revolutions have distanced our consciousness from this idea, even as they enabled ever more perfect caves to manifest. Our vocabulary has become corrupted and unclear. We started using words like "reality", and "literally", and "truth", when we mean the exact opposite. The conspiracy theorists and cultists, are just people who wandered into a new cave, with a different kind of fire, and differently curved walls, and they want to tell people from their old cave that they have found a way out of the cave into reality -- they do not yet realize (or do not want to accept), that they live in a network of caves, a network of different things in the same category. During the early 2020s, we did a lot of talking about the disappearance of "consensus reality". This is scientific terminology mapped over the idea of caves and cults. You can tell, because the phrase is an oxymoron. It is not reality, if it requires consensus. It is fantasy, it is fiction, it is a dream. The cave has indeed become so widespread that we even _call_ it reality. If you speak language, and read words, you are participating in a cult (we even call caves that had a kind of altar in the center a cult -- in Eurasia, there was a cave-cult called _the cult of the bear_, which had a bear skull placed in its center during the last ice age, and I would not be surprised if people spoke to it, with the help of hallucinogens). The only question is whether the cult is nourishing you or cannibalizing you. To the person you are responding to (user ocd): your cave (ladybird, your hypothetical tv-series), no longer nourishes you like it once did. Maybe find a new cave, build a fire in it. Unlike a television series, you can fork a code base. You make it into the perfect cave, just for you. And if another person likes this cave, chooses to sit by the fire with you, well, now you have a cult.
- gethly 8mo agoi rememebr seeing interviews saying rust is not suited for this project because of recursion and dom tree. how they tested multiple languages and settled on swift. then they abandon swift and now they shift towards rust. this entire project starts to look like "how am i feeling today?" rather than a serious project.
- tcfhgj 8mo agoSo Swift didn't turned out like they imagined and Rust is just the next best alternative to that failed vision using Swift. So far this is the first and only shift
- adastra22 8mo agoThey were doing their own custom language before Swift.
- tcfhgj 8mo agodidn't know > The browser and libraries are all written in C++. (While our own memory-safe Jakt language is in heavy development, it’s not yet ready for use in Ladybird.) https://awesomekling.github.io/Ladybird-a-new-cross-platform-browser-project/ https://awesomekling.github.io/Ladybird-a-new-cross-platform... only thing I could find - has it been actually used in Ladybird after all?
- LeFantome 8mo agoNo, they never completed or adopted their own language. It was back in the SerenityOS days, before the browser forked into its own project. https://github.com/SerenityOS/jakt https://github.com/SerenityOS/jakt
- MrFurious 8mo agoYes, i understand that in a personal project, but they have investors behind them.
- 8mo ago
- jvillasante 8mo ago> We’ve been searching for a memory-safe programming language to replace C++ in Ladybird for a while now. The article fails to explain why. What problems (besides the obvious) have been found in which "memory-safe languages" can help. Do these problems actually explain the need of adding complexity to a project like this by adding another language? I guess AI will be involved which, at this early point in the project would make ladybird a lot less interested (at least to me).
- panstromek 8mo ago> besides the obvious Well, what else is there besides the obvious? It's a browser.
- michaelcampbell 8mo ago> What problems (besides the obvious) have been found in which "memory-safe languages" can help. Why isn't that enough?
- nicoburns 8mo agoBrowsers are incredibly security-sensitive projects. Downloading untrusted code from the internet and executing is part of their intended functionality! If memory safety is needed anywhere it's in browsers.
- f311a 8mo agoYou don't want a browser with a bunch of RCEs that can be triggered by opening a web page...
- Perz1val 8mo agoYou do want a browser with RCE, but you want it to keep the it sandboxed. The hard part is executing the code safely
- norman784 8mo agoI guess you will need to wait for their Feb 2026 update.
- ramon156 8mo agoI'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 stance is. At least contributing will be a lot nicer from my end, because my PR's to Ladybird have been bad due to having no CPP experience. I had no idea what I was doing.
- dougiejones 8mo agoTFA mentions "the contributor's" stance on Swift.
- ramon156 8mo agoBut not the stance on Rust, which is something I'm wondering. I understand there's a core team assigned, but are the ~200 contributors okay with this migration?
- the_mitsuhiko 8mo agoWhy would 200 contributors have to be okay with this migration? The project has a leader, the leader makes decisions.
- gostsamo 8mo agobecause let's say 150 contributors might not be okay with the decision and leave. hard to lead from the front if there is nobody behind to be lead.
- swiftcoder 8mo agoTo be fair, any of them who didn't leave in the last few controversies probably won't leave over this.
- yanosc 8mo agoIf this means we will get an independent state-of-the-art browser engine, I'm all for it.
- youngtaff 8mo agoIMV Servo is going to be the independent state of the art browser
- Perz1val 8mo agoI have my doubts it'll ever be "finished". Servo gives strong vibes of a project that will avoid performance hacks, because they're not nice/state of the art code. I have no evidence, it's just the energy I've picked up from it
- djoldman 8mo agoA lot of the previous calculus around refactoring and "rewrite the whole thing in a new language" is out the window now that AI is ubiquitous. Especially in situations where there is an extensive test suite. Testing has become 10x as important as ever.
- pjmlp 8mo agoWell, I am on the provocative side that as AI tooling matures current programming languages will slowly become irrelevant. I am already using low code tooling with agents for some projects, in iPaaS products.
- anon-3988 8mo ago> Well, I am on the provocative side that as AI tooling matures current programming languages will slowly become irrelevant. I have the opposite opinion. As LLM become ubiquitous and code generation becomes cheap, the choice of language becomes more important. The problem with LLM for me is that it is now possible to write anything using only assembly. While technically possible, who can possibly read and understand the mountain of code that it is going to generate? I use LLM at work in Python. It can, and will, easily use hacks upon hacks to get around things. Thus I maintain that as code generation is cheap, it is more important to constraint that code generation. All of this assume that you care even a tiny bit about what is happening in your code. If you don't, I suppose you can keep banging the LLM to fix that binary blob for you.
- pjmlp 8mo agoLets say years of offshoring projects have helped to reach that opinion.
- _flux 8mo ago> The problem with LLM for me is that it is now possible to write anything using only assembly. While technically possible, who can possibly read and understand the mountain of code that it is going to generate? As a very practical problem the assembly would consume the context window like no other. And another is having some static guardrails; sometimes LLMs make mistakes, and without guard rails it debugging some of them becomes quite a big workload. So to keep things efficient, an LLM would first need to create its own programming language. I think we'll actually see some proposals for a token-effective language that has good abstraction abilities for this exact use.
- worldsavior 8mo agoGood step. It will bring many more contributors.
- zozbot234 8mo agoUsing LibJS with servo, when?
- pjmlp 8mo agoAll the best to them, however this feels like yah shaving instead of focusing into delivering a browser than can become an alternative to Safari/Chrome duopoly.
- cogman10 8mo agoAgreed. They said they ruled out rust in 2024, I believe the article they published was near the end of 2024 because I remember reading it fairly recently. Seems like a lot of language switches in a short time frame. That'd make me super nervous working on such a project. There will be rough parts for every language and deciding seemingly on whims that 1 isn't good enough will burn a lot of time and resources.
- cromka 8mo agoPart of browser experience is safety and migrating their JS library to Rust is probably one of the best ways to gain advantage over any other existing engine out there in this aspect. Strategically this may and likely will attract 3rd party users of the JS library itself, thus helping its adoption and further improving it. They're not porting the browser itself to Rust, for the record.
- norman784 8mo ago
- rausr 8mo agoI must admit to being somewhat confused by the article's claim that Rust and C++ emit bytecode. To my knowledge, neither do (unless they're both targeting WASM?) - is there something I'm missing or is the author just using the wrong words? EDIT: bramhaag pointed out the error of my ways. Thanks bramhaag!
- bramhaag 8mo agoBy 'Rust compiler' and 'C++ compiler', they refer to the LibJS bytecode generator implemented in those languages. This is about the generated JS bytecode.
- xwowsersx 8mo agoThey're referring to LibJS's bytecode (the internal instruction stream of Ladybird’s JS engine), not to Rust/CPP output formats.
- deleted 8mo ago[deleted]
- potato-peeler 8mo agoIs there any discussion on why D or even Ada was not considered? These languages have been around for long time. If they were willing to use llm to break the initial barrier to entry for a new language, then a case can be made for these languages as well.
- account42 8mo agoThey already made the mistake picking a niche language twice (first their own language, then Swift as a cross-platform language), why would you want them to make it a third time?
- potato-peeler 8mo agoWhat kind of response is this? I was asking if there was any technical evaluation on other languages. And D and Ada are not niche. They have been battle tested in critical software.
- Imustaskforhelp 8mo agoSwift had/has some problems in the language itself. It's not because of the niche nature of Swift that was the problem iirc. I don't think this is the right response because certainly a meaningful discussion could've definitely taken place and given how they were already open to other languages which was the reason why they picked Swift in the first place. I remember Andreas video where he talked about how people used rust in his codebase and they were so happy but later it became very difficult whereas they found with swift that it became easier to manage. That was the reason why they picked swift that time. Certainly their goal wasn't to pick a popular language (because if that's what you want use python or JS) but rather a language that was relevant to what they were building. So if D and Ada were relevant or not, that's the main point of discussion imo.
- yurishimo 8mo agoProbably contributing reasons? I imagine over time they will have a lot more Rust contributors than D or Ada.
- 8mo ago
- easton 8mo agoI know he doesn't make live coding videos anymore, but it'd be cool if Andreas showed off how this worked a little more. I'm curious how much he had to fix by hand (vs reprompting or spinning a different model or whatever).
- l5870uoo9y 8mo agoYou can checkout the pull requests related to LibJS: https://github.com/LadybirdBrowser/ladybird/pulls?q=is%3Apr+is%3Aclosed+LibJS https://github.com/LadybirdBrowser/ladybird/pulls?q=is%3Apr+...
- edgyquant 8mo agoWhat happened? It’s been awhile since I checked in but it seems he doesn’t work on serenity and doesn’t live stream anymore (and is now into lifting weights)
- Perz1val 8mo agoHe got his serenity and at the same time ladybird browser started getting somewhere, so he separated it out and went full on with it. From what I know, he was working on browsers before at Apple, so it was like he got ready to return
- markus_zhang 8mo ago[flagged]
- account42 8mo ago> We previously explored Swift, but the C++ interop never quite got there, and platform support outside the Apple ecosystem was limited. Why was there ever any expectation for Swift having good platform support outside Apple? This should have been (and was to me) already obvious when they originally announced moving to Swift.
- adastra22 8mo agoApple’s own marketing speak has Swift as a cross platform language. Just like, I suppose, C# is a cross platform language. Apple puts zero resources into making that claim reality, however.
- hocuspocus 8mo agoApple actually did put some resources behind it, the toolchain is reasonably pleasant to use outside macOS and Xcode, they have people building an ecosystem in the Swift Server Workgroup, and arguably some recent language design decisions don't seem to be purely motivated by desktop/mobile usage. But in the end I can't help but feel Swift has become an absolute beast of a multi-paradigm language with even worse compile times than Rust or C++ for dubious ergonomics gains.
- adastra22 8mo agoA language is more than a compiler. All of the Swift frameworks you would need to do anything actually useful or interesting in the language are macOS-only. You cannot develop in Swift for Windows/Linux/Android the way that you develop in Swift for macOS/iOS. That matters.
- hocuspocus 8mo agoYou don't need to convince me that Swift is poorly positioned there, but if you only care about server side (or possibly CLI) apps, the usable ecosystem on Linux isn't too shabby. Does it make sense compared to C#, Go, Rust or a JVM language? I don't know, but it's there, and Apple put some resources behind the initiative.
- nicoburns 8mo agoVery happy to see this. Ladybird's engineering generally seems excellent, but the decision to use Swift always seemed pretty "out there". Rust makes a whole lot more sense.
- VoxPelli 8mo agoServo makes a whole lot more sense: https://servo.org/ https://servo.org/
- LeFantome 8mo agoCan you send a Gmail in Servo? No? Ladybird is much further ahead in terms of actually rendering web pages that people use. The biggest advantage to Servo was that it is written in Rust. This move begins to nullify that advantage as well. Why exactly does Servo make more sense? I hope they both succeed. But Ladybird is more likely to become a usable browser first.
- cmrdporcupine 8mo agoThis move was only to port a part of their JS runtime pieces to Rust, that's it.
- usrbinenv 8mo agoThis will be another bad decision just like with Swift. From what I heard, Rust is notoriously bad at letting people define their own structure and instead beats you up until you satisfy the borrow checker. I think it'll make development slow and unpleasant. There are people out there who enjoy that, but it's not a fit for when you need to deliver a really huge codebase in reasonable time. I remember Andreas mentioning he just wanted something like C++, but with a GC and D would be absolutely perfect for this job.
- thiht 8mo agoNobody uses D
- usrbinenv 8mo agoAnd? Does it work? Because it does. It's a lot closer to C++ and you literally need like a week to start being productive and it's insanely flexible as a language. Nobody uses Swift also, but the additional problem with Swift was that it's entirely Apple-centric.
- p0nce 8mo agoThis is like the "real world" argument. Nobody uses that "in the real world", except well people that do.
- Kapendev 8mo agoWell, I do!?!! It's even faster than zoomer langs like Odin. You should try it.
- thiht 8mo agoCool, that seems like a rational choice. I hope this will help Ladybird and Servo benefit from each other in the long run, and will make both of them more likely to succeed
- Perz1val 8mo agoI hope it does not -> because we don't more browser crossbreeding
- silverwind 8mo agoSmall browsers need to unite if they ever hope to become relevant.
- silverwind 8mo agoDefinitely, would be great to see a Servo-based Ladybird.
- feverzsj 8mo agoGuess it will never come out.
- vipulbhj 8mo agoSomeone should try this with the “Ralph Wiggum loop” approach. I suspect it would fail spectacularly, but it would be fascinating to watch. Personally, I can’t get meaningful results unless I use the tool in a true pair-programming mode—watching it reason, plan, and execute step by step. The ability to clearly articulate exactly what you want, and how you want it done, is becoming a rare skill.
- simonw 8mo agoGiven the quality of their existing test suite I'm confident the Ralph Wiggum loop would produce a working implementation... but the code quality wouldn't be anywhere near what they got from two weeks of hands-on expert prompting.
- vipulbhj 8mo agoSure yeah, I can buy that, but that would be like collecting tech debt for generations.
- throwaway2037 8mo ago> Ralph Wiggum loop Can you explain more? (I know the reference that he is the idiot son of Chief Wiggum from The Simpsons.)
- simonw 8mo agohttps://ghuntley.com/loop/ https://ghuntley.com/loop/ and https://github.com/anthropics/claude-code/blob/main/plugins/ralph-wiggum/README.md https://github.com/anthropics/claude-code/blob/main/plugins/...
- woadwarrior01 8mo agoLooks like it's been renamed to ralph-loop for legal reasons. :D https://github.com/anthropics/claude-plugins-official/pull/142 https://github.com/anthropics/claude-plugins-official/pull/1...
- Fervicus 8mo ago> We know the result isn’t idiomatic Rust, and there’s a lot that can be simplified once we’re comfortable retiring the C++ pipeline. That cleanup will come in time. I wonder what kind of tech debt this brings and if the trade off will be worth whatever problems they were having with C++.
- cromka 8mo agoI don't think they were having problems with C++, they moved to Rust for memory safety. Mind that they migrated LibJS, their JavaScript library.
- snowhale 8mo ago[dead]
- surajrmal 8mo agoIt depends. I migrated a 20k loc c++ project to rust via AI recently and I would say it did so pretty well. There is no unsafe or raw pointer usage. It did add Rc<RefCell in a bunch of places to make things happy, but that ultimately caught some real bugs in the original code. Refactoring it to avoid shared memory (and the need for Rc<RefCell<>> wasn't very difficult, but keeping the code structure identical at first allowed us to continue to work on the c++ code while the rust port was ongoing and keep the rust port aligned without needing to implement the features twice. I would say modern c++ written by someone already familiar with rust will probably be structured in a way that's extremely easy to port because you end up modeling the borrow checker in your brain.
- rq1 8mo ago> I would say modern c++ written by someone already familiar with rust will probably be structured in a way that's extremely easy to port because you end up modeling the borrow checker in your brain. I can't stress out how much important this sentence is. I would even remove the "familiar with rust" part. Anyone who still thinks it's good to use C/CPP on modern hardware where Rust support is available and good: please print the sentence above and post it all over your place.
- throwaway2037 8mo agoFuck me. This is wild. Sorry for the potty mouth. > Porting LibJS > Our first target was LibJS , Ladybird’s JavaScript engine. The lexer, parser, AST, and bytecode generator are relatively self-contained and have extensive test coverage through test262, which made them a natural starting point. > Results > The requirement from the start was byte-for-byte identical output from both pipelines. The result was about 25,000 lines of Rust, and the entire port took about two weeks. The same work would have taken me multiple months to do by hand. I'm not here to troll the LLM-as-programmer haters, but Ladybird (and Rust!) is loved by HN, and this is a big win. How long until Ladybird begins to impact market dominance for Chrome and Firefox? My guess: Two years.
- surajrmal 8mo agoNote that Firefox doesn't have market dominance. It is under 5% market share. That said I imagine Firefox users to be the most likely to make the jump. However, the web is a minefield of corner cases. It's hard to believe it will be enough to make the browser largely useful enough to be a daily driver.
- NoboruWataya 8mo agoWhy do you think Firefox users would be most likely to make the jump? The main reason I see people give for supporting Ladybird is challenging the dominance of the incumbents. That's not really a great reason to switch from Firefox because, as you note, it doesn't have any dominance. And there's also an argument that splitting the non-Chrome market into two only increases Chrome's dominance. From what I can tell from HN, Brave seems to be popular with those users who hate Google but for whatever reason hate Mozilla even more, and I suspect those will be the most likely users to switch.
- surajrmal 8mo agoArguably anyone not using Chrome, safari or edge is the most likely to try Ladybird.
- tolerance 8mo agoSomething of a culture clash here ain’t it, albeit an imbalanced one.
- mghackerlady 8mo agoThat's a pivot, iirc they wanted to swift (I'm very glad they didn't do that). It's cool to see something like claude be useful for large scale projects like that
- cbondurant 8mo agoBased on the origins of Rust as a tool for writing the really thorny, defensive parsers of potentially actively hostile code for firefox, I have to imagine that another web browser is the most at-home place the language could ever be.
- jurschreuder 8mo agoOooh noooo I will have to fork it before it is too late!
- ZoomZoomZoom 8mo agoLooks like Andreas is a mighty fine engineer, but he's even better entrepreneur. Doesn't matter if intentional or not, but he managed to create and lead a rather visible passion project, attract many contributors and use that project's momentum to detach Ladybird into a separate endeavor with much more concrete financial prospects. The Jakt -> Swift -> Rust pivots look like the same thing on a different level. The initial change to Swift was surely motivated by potential industry support gain (i believe it was a dubious choice from purely engineering standpoint). It's awe-inspiring to see how a person can carve a job for himself, leverage hobbyists'/hackers' interest and contributions, attract industry attention and sponsors all while doing the thing he likes (assuming, browsers are his thing) in a controlling position. Can't fully rationalize the feeling, but all of this makes me slightly wary. Doesn't make it less cool to observe from a side, though.
- newswasboring 8mo ago> but all of this makes me slightly wary. Wary of what?
- carderne 8mo agoI'd say it's the idea/fact/feeling that, in 2026, agency matters more than skill/wisdom/intelligence. Long read on the topic (quite funny, covers Cluely): https://harpers.org/archive/2026/03/childs-play-sam-kriss-ai-startup-roy-lee/ https://harpers.org/archive/2026/03/childs-play-sam-kriss-ai...
- clouedoc 8mo agoProbably, Roy was born agentic as a part of a package which included an disregard for intellectual growth. This doesn't mean that being agentic cannot be cultivated by regular people. In 2026, yes, agency matters more than skill/wisdom/intelligence to get VC funds. But what's the point of agency alone if you are leading such a life? What gives me hope is that in 2026, skillful people can delegate a lot of their work to LLMs, which gives them time to learn the "agentic" part which is basically marketing and talking with people. (just thinking out loud)
- jonkoops 8mo agoI hope that this opens the door for collaboration between Ladybird and Servo, no need to reinvent the wheel for core components.
- mudkipdev 8mo agoCommenting about not reinventing the wheel on a Ladybird post is ironic
- jabl 8mo agoI thought the entire point of Ladybird was precisely to reinvent the wheel?
- jonkoops 8mo agoThis is also the case for Servo, so it makes sense to collaborate.
- VoxPelli 8mo agoServo has a distinct design goal that sets it apart from its predecessor within Mozilla and has already had offsprings that has made its way directly into Firefox. Its purpose is not to reinvent everything. It’s not a hype project.
- jonkoops 8mo agoServo's original purpose was to reinvent everything for Firefox to modernize the codebase, and make it secure and more performant (e.g. CSS styling engine, HTML parser, etc.) So it actually fits that purpose pretty well.
- nicoburns 8mo agoUnfortunately licence incompatibility may prevent that. Ladybird is BSD and Servo is MPL. This is also why there is only limited collaboration between Servo and the Rust GUI ecosystem.
- catlover76 8mo ago[dead]
- kneel25 8mo ago> After the initial translation, I ran multiple passes of adversarial review, asking different models to analyze the code for mistakes and bad patterns. I feel like you just know it’s doomed. What this is saying is “I didn’t want to and cannot review the code it generated” asking models to find mistakes never works for me. It’ll find obvious patterns, a tendency towards security mistakes, but not deep logical errors.
- herrkanin 8mo agoYour argument is just as applicable on human code reviewers. Obviously having others review the code will catch issues you would never have thought of. This includes agents as well.
- DetroitThrow 8mo ago>Your argument is just as applicable on human code reviewers. The tests many of us use for how capable a model or harness is is usually based around whether they can spot logical errors readily visible to humans. Hence: https://news.ycombinator.com/item?id=47031580 https://news.ycombinator.com/item?id=47031580
- Fervicus 8mo agoWith humans though, I wouldn't have to review 20k lines of code at once.
- kneel25 8mo agoThey’re not equal. Humans are capable of actually understanding and looking ahead at consequences of decisions made, whereas an LLM can’t. One is a review, one is mimicking the result of a hypothetical review without any of the actual reasoning. (And prompting itself in a loop is not real reasoning)
- grougnax 8mo agoGreat! I can't wait they totally ditch C++
- pizlonator 8mo agoPorting the JS parser to Rust and adopting Rust in other parts of the engine while continuing to use C++ heavily is unlikely to make Ladybird meaningfully more secure. Attackers are surprisingly resilient to partial security.
- cod1r 8mo ago[flagged]
- pizlonator 8mo agoNo, just saying facts
- npalli 8mo agoIf it is this easy, surely the trend is Rust output being an intermediate pass of the LLM super compiler. A security subset if you will (like other kinds of optimization), it will move from Rust specs to some deeper level of analysis and output the final executable. Some brave souls will read the intermediate Rust output (just like people used to read the assembler output from compilers) but the LLM super compiler will just translate a detailed English like spec into final executables.
- Perz1val 8mo agoDo you seriously think LLMs will not just spam unsafe blocks in it like they do with any task ever?
- gpm 8mo agoI'd generally be quite surprised to see LLMs spam unsafe blocks, both because that's behavior that I haven't observed while using them and because that contradicts my mental model of them where they imitate the styles of code that they were trained on (which in rust generally does not include spamming unsafe).
- alabhyajindal 8mo ago> This is not becoming the main focus of the project. We will continue developing the engine in C++, and porting subsystems to Rust will be a sidetrack that runs for a long time. I don't like this bit. Wouldn't it be better to decide on a memory-safe language, and then commit to it by writing all new code in Rust, or whatever. This looks like doing double the work.
- nicoburns 8mo agoIt 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 8mo agoYou 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 8mo ago> 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 https://github.com/SerenityOS/jakt
- Shank 8mo agoCompletely ignoring the Rust aspect, I’m disappointed that two weeks were spent on something that isn’t getting Ladybird to a state where it can be used as a daily driver. Ladybird isn’t usable right now, and if it was usable, improving the memory safety would be a commendable goal. Right now I just feel like this is premature.
- alabhyajindal 8mo agoFrom their post on Twitter in 2024 when they adopted Swift, with a comment on Rust. My general thoughts on Rust: - Excellent for short-lived programs that transform input A to output B - Clunky for long-lived programs that maintain large complex object graphs - Really impressive ecosystem - Toxic community https://xcancel.com/awesomekling/status/1822241531501162806 https://xcancel.com/awesomekling/status/1822241531501162806
- throw_rust 8mo agoMayhaps he had a Damascene conversion? Not that I ever understood the need to change from C++ in the first place though.
- fmajid 8mo agoConsidering David Tolnay's indefensible treatment of JeanHeyd Meneide, I'm inclined to agree with Kling on the toxicity of the Rust community. Evangelical fervor does not excuse douchebaggery.
- feverzsj 8mo agoMost likely some big sponsor requires them turn to AI slops.
- deleted 8mo ago[deleted]
- jp1016 8mo agoThe byte-for-byte identical output requirement is the smartest part of this whole thing. You basically get to run the old and new pipelines side by side and diff them, which means any bug in the translation is immediately caught. Way too many rewrites fail because people try to "improve" things during the port and end up chasing phantom bugs that might be in the old code, the new code, or just behavioral differences. Also worth noting that "translated from C++" Rust is totally fine as a starting point. You can incrementally make it more idiomatic later once the C++ side is retired. The Rust compiler will still catch whole classes of memory bugs even if the code reads a bit weird. That's the whole point.
- cyode 8mo agoI hope, with the velocity unlocked by these tools, that more pure ports will become the norm. Before, migrations could be so costly that “improving” things “while I’m here” helped sell doing the migration at all, especially in business settings. Only to lead to more toil chasing those phantom bugs.
- ozgrakkurt 8mo agoOne 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 useful code. Best option after proper rewrite is binding. And copy-paste with LLM comes way below these options imo. If you look at real world, basically all value is created by boring and hated languages. Because people spent so much effort on making those languages useful, and other people spent so much effort learning and using those languages. Don’t think anyone would prefer to work in a rust codebase that an LLM copy-pasted from c++, compared to working on a c++ codebase written by actual people that they can interact with.
- ukblewis 8mo agoIt depends on your goals. If your only initial goal is to ensure the safety of your code, and that is rather important for a browser!
- MontagFTB 8mo agoAny word on how much more memory safe the implementation is? If passing a previous test suite is the criteria for success, what has changed, really? Are there previous memory safety tests that went from failing to passing? I am very interested to know if this time and energy spent actually improved memory safety. Other engineers facing the same challenges want to know!
- Retr0id 8mo agoIf the previous impl had known memory safety issues I'd imagine they'd fix them as a matter of priority. It's hard to test for memory safety issues you don't know about. On the rust side, the question is how much `unsafe` they used (I would hope none at all, although they don't specify).
- MontagFTB 8mo agoIt is entirely possible a Rust port could have caught previously unknown memory safety issues. Furthermore, a Rust port that looks and feels like C++ may be peppered with unsafe calls to the point where the ROI on the port is greatly reduced. I am not trying to dunk on the effort; quite the contrary. I am eager to hear more about the goals it originally set out to achieve.
- estebank 8mo agoYou can look: https://github.com/LadybirdBrowser/ladybird/pull/8104/files?file-filters%5B%5D=.rs&file-filters%5B%5D=.toml&show-viewed-files=true https://github.com/LadybirdBrowser/ladybird/pull/8104/files?... It seems like it is used mostly for FFI.
- Perz1val 8mo agoNone at all, the generated AST and bytecode are stated to be identical
- MiiMe19 8mo ago[flagged]
- blub 8mo agoI feel similar about the potential of this technique and have heard this from other C++ developers too. Rust syntax is a PITA and investing a lot of effort in the language doesn’t seem worth the trouble for an experienced C++ developer, but with AI learning, porting and maintenance all become more accessible. It’s possible to integrate Rust in an existing codebase or write subparts of larger C++ projects in Rust where it makes sense. I was recently involved in an AI porting effort, but using different languages and the results were fine. Validating and reviewing the code took longer than writing it.
- PowerElectronix 8mo agoWhat are Rust programmers to do now that LLMs can port code to Rust??
- WesolyKubeczek 8mo agoI wouldn't mind if one result of this was a writeup on what patterns/antipatterns are there when converting code and concepts that used to be very aligned with C++-style OOP, deep inheritance and all that jazz, to what feels natural in Rust, and how you can rephrase those concepts without loss in the substance of what you need to do. I guess it's a long way off, since the LLM translation would need to be refactored into natural Rust first. But the value of it would be in that it's a real world project, and not a hypothetical "well, you could probably just...".
- zppln 8mo agoCool project, but I'm a bit curious hearing how the rest of the project feels about this? I'm not sure how I'd feel if I woke up and found a system I worked on had been translated into an another language I'm not neccessarily familiar with. And I'm not sure I'd want to fix an non-idiomatic "mess" just because it's been translated into a language I'm familiar with either (although I suspect they'll have no problem attracting rust developers).
- drnick1 8mo agoI wonder what is gained by this port though, if the C++ codebase already employed modern approaches to memory management. It's entirely possible that the Rust version will perform worse too as compilers are less mature.
- maleldil 8mo ago"modern approaches to memory management" aren't enough for complete memory safety.
- drnick1 8mo agoMaybe, but it's certainly possible to write memory safe code in C++. It may be more or less difficult, but it isn't typically the ONLY objective of a project. C++ has other advantages too, such as seamless integration with C APIs and codebases, idiomatic OOP, and very mature compilers and libraries.
- npn 8mo agoMy intuition is that they will convert to zig again when it stables. If it is possible to do it using LLM in 2 weeks for rust, then it would be the same for zig, too. While rust is nice on paper, writting complex software in it is mentally consuming. You can not do it for a long time.
- lukaslalinsky 8mo agoIf they are looking for a memory-safe language, why would they convert to Zig?
- hu3 8mo agoIf they do, it could be because safety is a gradient and one variable among many in software development, albeit a very important one when it comes to browsers.
- nothrows 8mo agoThis is sort of hilarious if you think about it. The Firefox browser is completely written in Rust. Now Ladybird is a "human-directed ai" Rust browser. Makes you wonder how much of the code the two browsers will share going forward given llm assisted autocompletes will pull from the same Rust Browser dataset.
- d-us-vb 8mo agoProbably not much: the requirement is exact equivalence of program inputs to outputs, and as such the agents are performing very mechanical translation from the existing C++ code to Rust. Their prompts aren't "implement X browser component in rust", they're "translate this C++ code to Rust, with these extra details that you can't glean from the code itself."
- feverzsj 8mo agoIt's like only 10% of Firefox is rust.
- DetroitThrow 8mo agoOnly a small portion of Firefox is written in Rust. Apparently some of the most performant and least buggy parts are those in Rust, but again, only parts like the CSS engine.
- TiredOfLife 8mo agohttps://github.com/mozilla-firefox/firefox https://github.com/mozilla-firefox/firefox Rust isn't even mentioned in languages used.
- hu3 8mo agoI wonder where did you get the idea that Firefox was all Rust. Made me curious.
- sohpha6B 8mo agoFor those unaware: the author holds some very unfriendly views. https://drewdevault.com/2025/09/24/2025-09-24-Cloudflare-and-fascists.html https://drewdevault.com/2025/09/24/2025-09-24-Cloudflare-and...
- artur-gawlik 8mo agoInteresting in context of that some time ago Andreas said that they failed on porting TypeScript compiler from TypeScript itself to Go lang by using LLMs and they went with manual port https://youtu.be/uMqx8NNT4xY?si=Vf1PyNkg3t6tmiPp&t=1423 https://youtu.be/uMqx8NNT4xY?si=Vf1PyNkg3t6tmiPp&t=1423
- onetom 8mo agoWere there any immediate benefits of this conversion, e.g. reduced memory use or lower CPU utilization?
- GalaxyNova 8mo agoLikely the opposite, as safe Rust has some extra safety checks for things like array bounds.
- shevy-java 8mo agoSome time ago I was perma-banned from the Ladybird github repository. One can say it is warranted, or not (people have their own opinion; I completely disagree with their decision). Now that this has happened, I can speak more freely about Ladybird. Naturally this will be somewhat critical, but I need to first put things into context. I do believe that we really need an alternative to Google dominating our digital life. So I don't object that we need alternatives; whether Ladybird will be an alternative, or not, will be shown in the future. Most assuredly we need competition as otherwise the Google empire moves forward like Darth Vader and the empire (but nowhere near as cool as that; I find Google boring and lame. Even skynet in Terminator was more fun than Google. Google just annoys the heck out of me, but back to the topic of browsers). So with that out of the way ... Ladybird is kind of ... erratic. Some time ago, perhaps two months or three, Andreas suddenly announced "Swift WILL BE THE FOREVER FUTURE! C++ sucks!!!". People back then were scratching heads. It was not clear why Swift is suddenly our saviour. Ok, now we learn - "wait ... swift is NOT the future, but RUST is!!!". Ok ... more head-scratching. We are having a deja-vu moment here... but it gets stranger: "We previously explored Swift, but the C++ interop never quite got there, and platform support outside the Apple ecosystem was limited. Rust is a different story." and then: "I used Claude Code and Codex for the translation. This was human-directed, not autonomous code generation" So ... the expertise will be with regards to ... relying on AI to autogenerate code in ... Rust. I am not saying this is a 100% fail strategy, mind you. AI can generate useful code, we could see that. But I am beginning to have more and more doubts about the Ladybird project. Add to this the breakage of URLs that are used by thousands or million people world-wide (see the issues reported on the github tracker); or also the fact that, once you scale-up and more and more people use ladybird, will you be able to keep up with issue trackers? Will you ban more people? In a way it is actually good that I am no longer allowed to make comments on their repository because I can now be a lot more critical and ask questions that the ladybird team will have to evaluate. Will ladybird blend? Will it succeed? Will it fail? Yes, it is way too early to make an evaluation, so we should evaluate in some months or so, perhaps end of this year. But I am pretty certain the criticism will increase, at the least the moment they decide to leave beta (or alpha or whatever model they use; they claimd they want a first working version in this year for Linux users, let's see whether that works).
- mrorigo 8mo agoÄNTLIGEN!
- fdefitte 8mo ago[dead]
- kayo_20211030 8mo agoI don't get it, and I don't have a dog in the C/C++ vs. Rust race. Ladybird has ~1200 contributors with a predominance of C++ contributions, followed by HTML, and with "other" lying at 0.5%. That's a lot of people contributing. How many of them will be less willing to contribute in the future, and less productive when they do if a sizable portion is in Rust? Maybe there'll be more contributions and maybe there'll be less. I don't know. If you've managed to develop a community of 1200 developers who are willing to advance the project why upset the applecart?
- Perz1val 8mo agoThere is a flock of people yelling around that they'd contribute if it was Rust, but won't touch C++
- einpoklum 8mo agoChatbot-translated code which is C++ foisted onto Rust? I will respectfully roll my eyes. Ah, but I see they actually haven't done that to most of their code, so maybe it's just a bit of pandering to the hype and fashion.
- storus 8mo agoThis is really YOLOing as the original author doesn't know Rust well so what happens if they hit some complex production issue LLM aren't aware of? Hiring an expensive consultant to fix that until the next LLM iteration?
- etcetera1 8mo ago> what happens if they hit some complex production issue they learn Rust it takes a couple of years it's not that hard.
- drakythe 8mo agoI'm as anti LLM use as they come, but this appears to be migrating libraries from already funcitoning C++ code. In the case of your hypothetical I suspect the course of action will be "shelve this library port until someone with domain expertise and Rust experience can look at it". Its not like he chucked the whole codebase at the GenaI gods and said "Port it to Rust!".
- bgdkbtv 8mo agoThis may sound stupid, but I wonder if using GPUI for a web browser could have some performance benefits...
- Narishma 8mo agoI don't get the impression they care that much about performance. Besides, it would limit the number of platforms it could run on if it requires a recent GPU.
- mococa 8mo agoThey are lost. C & C++ are absolutely fine.
- xxxx_xxxx 8mo ago[dead]
- rhabarba 8mo agoI'm still glad that NetSurf exists.
- kopirgan 8mo agoHow is this approach better than letting claude or some AI catch memory bugs better than humans in the c++ code itself? Given it's not launched and it's donor driven, I guess conserving developer time is a key priority? Dual track sucks lots of time?
- unit149 8mo ago[dead]
- lordofgibbons 8mo agoPardon 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?
- myHNAccount123 8mo agoAdd the fact that AI is writing the rust code...
- Zarathustra30 8mo agoOnce you get a byte-by-byte duplicate, you can start refactoring into idiomatic Rust. Convert pointers to references, rip out unsafe blocks, and let Clippy go ham.
- jcl 8mo agoThe 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.
- EE84M3i 8mo agoThat matches my understanding too. If they had developed a technique to get a modern C++ compiler and rustc to generate exactly the same output for any program (even a trivial one) I think that would be huge news and I would love to see all the linker hacking that would involve.
- pornel 8mo agoI'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.
- amedvednikov 8mo agoCool! I've translated it from Rust to V in 45 minutes. Works great: https://github.com/medvednikov/libjs_v https://github.com/medvednikov/libjs_v Compiles in 0.2 seconds on my M5 (compared to Rust's 3.3 seconds).
- Deanoumean 8mo agoLol 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.
- GaggiX 8mo agoHe is working on the web browser.
- rjh29 8mo agoSerenity was literally a distraction for his substance addiction issues. It's pretty clear he's productive and he and his team have worked on Ladybird for several years straight now. How many web browsers or OSs have you developed from scratch?
- kitswas 8mo agoWould rather use Servo. Atleast it has downloadable binaries.
- marxisttemp 8mo agoI don’t think I want to use a vibe-coded browser, unless “human-directed” just means that a human coded it and asked clarifying questions to the AI.
- roger110 8mo ago"The web platform object model inherits a lot of 1990s OOP flavor, with garbage collection, deep inheritance hierarchies, and so on. Rust’s ownership model is not a natural fit for that." I'm confused about this part. What part of the browser did they want GC and inheritance for? I'd get it if they were writing the UI in this, but the rest of this post is about the JS engine. They weren't going to 1:1 map JS objects to Swift objects and rely on ARC to manage memory, were they?
- panstromek 8mo agoLot of DOM APIs are like that. You have methods like element.[parent|children]() which implies circular structure, and then you have APIs like element.click(), which emits a click event that bubbles through the DOM - which means that element has to have some mutable reference to the DOM state. Or even element.remove(), which seems like a super weird api to have on an element of a collection, from Rust API design point of view. You can model these with reference counting, but this turned out unfeasible in browsers. There's a great talk from when Blink (Chrome) transitioned from reference counting to GC, which provides a lot more details about these problems in practice: https://www.youtube.com/watch?v=_uxmEyd6uxo https://www.youtube.com/watch?v=_uxmEyd6uxo > I'd get it if they were writing the UI in this, but the rest of this post is about the JS engine. I think this might be the reason they started with the JS engine and not with some more fundamental browser structures. JS object model has these problems, too, but the engine has to solve them in more generic way. All JS objects can just be modeled as some JSObject class/struct where this is handled on the engine level. DOM and other browser structures are different because the engine has to understand them, so the browser developers have to interact with the GC manually and if you watch the talk above, you'll see that it's quite involved to do even in C++, let alone in Rust, which puts a bunch of restrictions on top of that.
- umairnadeem123 8mo ago[dead]
- Surac 8mo agoThis byte for byte output is the right way to go. But it depends on test cases. Hope the amount of cases cover all possible combination of input
- RustSupremacist 8mo ago[flagged]
- AlexCoventry 8mo ago> If you look at the code, you’ll notice it has a strong “translated from C++” vibe. That’s because it is translated from C++. The top priority for this first pass is compatibility with our C++ pipeline. The Rust code intentionally mimics things like the C++ register allocation patterns so that the two compilers produce identical bytecode. Correctness is a close second. We know the result isn’t idiomatic Rust, and there’s a lot that can be simplified once we’re comfortable retiring the C++ pipeline. Does this still get you most of the memory-safety benefits of using Rust vs C++?
- joelthelion 8mo agoI think this largely depends on how much unsafe Rust they produced.
- jillesvangurp 8mo agoTranslating software that has a lot of tests is easy for LLMs. I think we'll be seeing a lot more of that in the next years. But it will take some time for people to build up more trust in these tools. Good test harnesses are a key enabler. The inevitable cleanup that will follow this could be done the same way. Refactoring like that can be done in more bite sized chunks, which makes it easier to review what is happening and control how it is done.
- _zagj 8mo agoA lot of the interest in Ladybird and its parent project, SerenityOS, stemmed from the bespoke, "from scratch" approach Andreas advocated. If they're going to start vibe-coding everything, then what's the point of the top-to-bottom wheel reinvention they're doing? E.g., why even bother maintaining their own, custom XML parser instead of using any of the multitude that already exist (including in Rust) if they're ultimately going to lean heavily on AI in the course of developing it, since that inherently involves laundering existing implementations? This project, of all of them, throwing in the towel on AI makes me fear AI abstainers have no future.
- kittikitti 8mo agoThis is great! I'm very excited about Ladybird. My current browser, Brave, is the best of the worst but Ladybird is the best of the best. On another note, I'm hoping iOS will eventually let go of their control over WebKit, however wishful it might be.
- andsoitis 8mo ago> We will continue developing the engine in C++, and porting subsystems to Rust will be a sidetrack that runs for a long time. So, even though they want the code base to be in Rust, they will continue writing new code in C++ and then translating it to Rust later to remove the C++ they just added. There must be a really good reason for this, such as Rust doesn’t interop well with C++, otherwise this seems like a poor decision.
- yreg 8mo agoIsn't the reason simply that they want to code in C++? This is a passion project.
- andsoitis 8mo ago> Isn't the reason simply that they want to code in C++? I don't know that that is the reason, given the opening lines of the article: We’ve been searching for a memory-safe programming language to replace C++ in Ladybird for a while now. We previously explored Swift, but the C++ interop never quite got there, and platform support outside the Apple ecosystem was limited. Rust is a different story. The ecosystem is far more mature for systems programming, and many of our contributors already know the language. Going forward, we are rewriting parts of Ladybird in Rust.
- yreg 7mo agoThat does not explain why they plan to continue writing it in C++.
- panstromek 7mo ago> There must be a really good reason for this, such as Rust doesn’t interop well with C++ Yea, I'd bet it's that. Ideally, you'd want to stop writing C++ and continue with Rust on all new code, but Rust has stricter semantics, so the interop is somewhat "easy" in one direction, but very hairy in the other direction. This means that in practice, you want to start porting from leaf components and slowly grow closer to the root, which stays in C++ for quite some time and just calls into Rust through C API (or something close to it). If you're curious about the topic, there's a interop library called Zngur (https://hkalbasi.github.io/zngur/ https://hkalbasi.github.io/zngur/), which is built on this assumption. They have a pretty good explanation of the concrete problems on the homepage.
- latentdream 8mo agoDo we know what was the problem with the C++ version in the first place ? Why not keep it as is ?
- nyarlathotep_ 8mo ago(Un?)ironically enough, Mr Kling was one of the people that (indirectly) first got my attention wrt LLM coding. I watched some of his streams on the development of the JIT compiler (what this change set seems to replace) on one of his streams, and was blown away by the quality of Copilot generated suggestions/completions on an (under-represented) domain (x86 opcodes, etc). This was before Claude Code et al, and pretty early-on for LLM tooling.
- poulpy123 8mo agoDidn't they already switched from one language to another ?
- potus_kushner 7mo agobleh. i hate how everything gets rustified and more and more critical infrastructure is at the whims of the rust corporation. as a reminder, rust is a language without a spec, without a clear bootstrapping path (one has to trust binaries provided by them), and a history of breaking changes with almost every minor release. getting a rust compiler built from scratch on a new OS/Arch like the author's serenityOS is an almost impossible task. i had high hopes for ladybird to become an alternative browser anyone with a working C++ compiler could build on whatever platform.