Live data from Hacker News

Claude Code uses Bun written in Rust now

simonwillison.net

791–800 of 920 posts

Re: Claude Code uses Bun written in Rust now

#791
post #700

Earlier quoted context omitted.

Swift is very weak outside Apple ecosystem, compared to Rust. Not sure nowadays, but Swift used to have breaking changes each major release, that's a non go for a big project.

But Swift has a stable ABI which neither Zig nor Rust could provide.

How important is stable ABI for projects like Bun? I think it only matters if you are building a shared library.

Re: Claude Code uses Bun written in Rust now

#792
post #223

Maybe I’m taking crazy pills, but I’m still stuck on “why the hell does a TUI need to run in terminal React by way of JavaScript” The fact that Anthropic felt the need to buy a runtime so they could make their TUI better speaks more to the quality of engineering than anything else IMO. If rewrites are so easy, why not rewrite CC in a native language? Would’ve been a hell of a lot cheaper.

I never knew that running an interactive program in my terminal would absolutely rinse my CPU and battery but that's what Claude, OpenCode and Ghostty have colluded to achieve. Even when the laptop is asleep overnight it's practically melting. I'm sure there was some logical reason for shoehorning web technology into this stack given that we have a good 40 years or so of experience with interactive terminal programs…

> Even when the laptop is asleep overnight it's practically melting.

Then something is waking it up and it's not asleep at all. Asleep the CPU shouldn't be running.

Re: Claude Code uses Bun written in Rust now

#793
post #679

Earlier quoted context omitted.

> The original code was one giant unsafe block True. > has fewer bugs Nope, this is demonstrably false because Rust has its own invariants around its types and the codebase is violating a lot of them. > every potential memory issue is neatly annotated by an unsafe block "Potential memory issue" can originate in unsafe blocks and safe code that are able to alternate the input condition of these unsafe blocks. Guess wh…

For someone who is not a rust dev, would you mind giving me an example of this: "Nope, this is demonstrably false because Rust has its own invariants around its types and the codebase is violating a lot of them."

An "unsafe" in rust is like an axiom in mathematics. You can use to prove higher level theorems but it has to make sense.

The second that you start to introduce nonsensical axioms (or bugs in unsafe sections) all your proven correct theorems will be worthless.

Re: Claude Code uses Bun written in Rust now

#794
post #505

Earlier quoted context omitted.

Is that before or after the earths atmosphere acidifies for humans and our bodies can’t hold enough phosphorus or calcium for basic metabolic tasks? You have until 2050: https://doi.org/10.1007/s11869-026-01918-5

these doom and gloom reports also said half the land will be under water by now and average temperature will be 40c. Didn't happen. Earth is in a cooler period and it will get very warm. These crappy climate change activists will not get anything done but to hold us back. We need more power, more tech, and more abundance of things. We will need to engineer our way out of real climate change.

Oh we should certainly trust the opinion of the science denier. Surely his opinions will be based on hard data and not on feelings!

Re: Claude Code uses Bun written in Rust now

#795
post #700

Earlier quoted context omitted.

Swift is very weak outside Apple ecosystem, compared to Rust. Not sure nowadays, but Swift used to have breaking changes each major release, that's a non go for a big project.

But Swift has a stable ABI which neither Zig nor Rust could provide.

only on macOS. On other platforms ABI is not stable.

Re: Claude Code uses Bun written in Rust now

#796
post #784
post #723

Earlier quoted context omitted.

Mu. Invalid question. Rust doesn't disable compiler features. It gives you extra set of footguns when you ask for it. As for the actual unloaded question, "What's the point of unsafe in Rust?" it is to contain and make it easier to identify sources of UB.

The whole point of the rust rewrite is that bun is now thought to rely on rust’s memory safety features, but that assumption doesn’t hold if everything’s inside an unsafe block.

Only ~4% of code is inside an unsafe block, so the idea is that for new code/contributions, the chance of introducing a new memory-safety bug is an order of magnitude lower.

Maybe in the future the unsafe code will go down to 1%, bringing that to two orders of magnitude.

Of course, only time will tell if that is true or not, but from experience I’d be willing to bet it is.

Re: Claude Code uses Bun written in Rust now

#797
Is anyone else failing to understand all the internet drama surrounding this?

The rewrite may work out on a technical level or it may not. Let's wait and see. The Bun project did not swear a blood oath to use Zig forever, and it's ultimately their choice to switch to a different programming language.

Beyond that, people seem to be incredibly emotionally involved with this, for reasons that entirely escape me.

Re: Claude Code uses Bun written in Rust now

#798

Earlier quoted context omitted.

The answer is those are the tools their lead engineers knew, so they repurposed them rather than learning other paradigms .

To the man with a hammer…

This saying has been abused 10 ways til Sunday.

"I'm using technology I know that will get us there" is not the same as treating every problem as a nail. It's making a practical choice that probably also had time constraints and other factors we don't know.

Re: Claude Code uses Bun written in Rust now

#799
post #747
post #639

Earlier quoted context omitted.

Why not using Swift?

Andreas Kling talked about it. It boils down to C++ interop sucks (no surprise for lang made by Apple), ecosystem is tiny, Rust works well enough with LLMs. https://youtu.be/DbHjKi_jASY

Swift is one of the few toolchains that actually has some kind of builtin C++ interop, alongside Objective-C++, D, .NET (via C++/CLI), Carbon (eventually).

Re: Claude Code uses Bun written in Rust now

#800
post #793
post #679

Earlier quoted context omitted.

For someone who is not a rust dev, would you mind giving me an example of this: "Nope, this is demonstrably false because Rust has its own invariants around its types and the codebase is violating a lot of them."

An "unsafe" in rust is like an axiom in mathematics. You can use to prove higher level theorems but it has to make sense. The second that you start to introduce nonsensical axioms (or bugs in unsafe sections) all your proven correct theorems will be worthless.

But code is not mathematics, so incorrect code is not worthless, it’s just worth less.

It’ll most likely still do 99% of the things people need it to do, there’ll be a an issue created for that broken 1%, and eventually it’ll be iterated upon and fixed.

Unless you’re working on a security boundary of course, there you should treat it like maths.

Post reply on HN