Live data from Hacker News

Claude Code uses Bun written in Rust now

simonwillison.net

381–390 of 920 posts

Re: Claude Code uses Bun written in Rust now

#381

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.

> why not rewrite CC in a native language?

It's hell to maintain for not much gain (for a use case like this at least). As much as it's become a meme, JS and web tech in general has become extremely portable and stable.

I also don't think Anthropic bought bun to make their TUI better. They could have forked it, they bought bun because it incidentally was excellent for the way agents prefer to work and they wanted to capture that audience.

Re: Claude Code uses Bun written in Rust now

#382

Earlier quoted context omitted.

Sorry you think they’re not going to continue developing and improving bun and making it more idiomatic? Given the success of the port so far and the fact that CC is now running on rust Bun, that seems highly unlikely to me.

That's a stated goal, so nope. But releasing it before any cleanups is another story. I'd also like to inform you that - the current success metrics solely consist of their advertisement, my eyes looking at the code strongly suggest otherwise - the Bun team lacks knowledge to actually make it more idiomatic: none of the Bun team has written any Rust and relying on model knowledge is already proven insufficient. The r…

> the Bun team lacks knowledge to actually make it more idiomatic: none of the Bun team has written any Rust

Do you know how silly this sounds? Good engineers can work in any language. At the top companies (of which Anthropic is certainly one) they don’t have “C++ engineers” and “rust engineers” they just have engineers.

Re: Claude Code uses Bun written in Rust now

#383
post #269
post #85

Earlier quoted context omitted.

You, by your own admission, haven't even written a single line of Zig despite having ~31 Zig projects on GitHub. I don't think your knowledge of the language is to be trusted in almost any capacity. This might seem harsh but I don't trust someone who's experience with a language amounts to slopping out 30+ repositories and not even engaging with the language normally.

By my own admission I wrote ~100K loc in zig-head. Having a background in linux kernel development of all things I can tell you that Zig is so much better than C or Rust, that I think linux kernel rush to rust is misguided.

I haven't even stated whether I agree with the opinion that Zig is worth it, in fact I do think Zig is worth it for a large set of problems and I wrote Zig for years, I am stating simply that I would never trust anyone who's self-admitting that they don't even write the language they're arguing for when it comes to opinions on whether it's good or not. It's not really about whether Zig is good, it's about someone who doesn't even write the language and doesn't even know it, not having a valuable opinion on it.

Re: Claude Code uses Bun written in Rust now

#384

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.

> why not rewrite CC in a native language? It's hell to maintain for not much gain (for a use case like this at least). As much as it's become a meme, JS and web tech in general has become extremely portable and stable. I also don't think Anthropic bought bun to make their TUI better. They could have forked it, they bought bun because it incidentally was excellent for the way agents prefer to work and they wanted to…

I think they bought Bun because it was a supply chain risk for them.

Their new flagship product (earning them billions of dollars in revenue per month) was dependent on a platform maintained by a tiny startup.

Buying Bun was a very rational way to reduce that risk, epically since it also got them some top tier engineering talent.

Thinking about that further, I wonder if that was part of the rationale for switching from Zig to Rust that they haven't talked about?

Zig is a much riskier bet for your multi-billion dollar cash cow than Rust is.

But saying that out loud would be rude - they took steps to NOT openly criticize Zig, even after Zig's founder did not show them the same courtesy.

Re: Claude Code uses Bun written in Rust now

#385
post #18

Earlier quoted context omitted.

It’s made absolutely no negative difference, as we’ve seen in the real world in the last 60 days since the merge. I feel weird having to defend reality; reality being that it was merged nearly 2 months ago and tons of people have had their pitchforks out without a shred of actual evidence that this made bun worse in any measurable way. But they still insist it was a mistake. I’ve never met Jared or the bun team but I…

The crux is: > What is the governance structure for Bun by the way? Couldn't find any documents/explanations about how it's supposed to work. I'm guessing it's essentially just "Anthropic decides what gets done and accepted" today? And this is a valid question. You are not "defending reality" by refusing to listen to it. In summary and based solely on my understanding: - Jared misled people about the intentions of th…

Sometimes the questions aren't justified, though, like when someone else’s project is someone else’s project.

It seems like when some folks see “open source” they think the project maintainers owe them something.

An open source MIT license of the source code is very different from being the original copyright holder.

Re: Claude Code uses Bun written in Rust now

#386
post #236

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.

It largely works and it's a massive business success. This is the classic engineer asking the 'why this technology?' to what amounts to a business question. They chose it early on, it works, and it makes obscene amounts of revenue. End of story. That doesn't mean it was the "greatest" choice, or has a perfect technical architecture. Rewrites are never easy, even the bun rewrite. But a non-UI developer tool with a rig…

[dead]

Re: Claude Code uses Bun written in Rust now

#387
post #175

Anecdotal, but I’ve been getting segfaults in Claude Code. I run inside Kitty tabs, and the entire tab becomes unusable when this happens. No response to inputs at all from that point. When this happens, a link shows up to report the issue. It’s not clickable (likely due to the segfault), and perhaps more important: it’s encoded, so you can’t see what you would be sending in your report. Hope it gets better.

Segfaults were a thing with the Zig version. Purely based on the fact it's a line by line translation of the Zig code to unsafe Rust, all the Zig code that caused segfaults is going to also cause segfaults in the Rust version. The Rust code won't fix it until they get to the point of refactoring it into idiomatic and memory safe Rust.

Re: Claude Code uses Bun written in Rust now

#388

Earlier quoted context omitted.

That's a stated goal, so nope. But releasing it before any cleanups is another story. I'd also like to inform you that - the current success metrics solely consist of their advertisement, my eyes looking at the code strongly suggest otherwise - the Bun team lacks knowledge to actually make it more idiomatic: none of the Bun team has written any Rust and relying on model knowledge is already proven insufficient. The r…

> the Bun team lacks knowledge to actually make it more idiomatic: none of the Bun team has written any Rust Do you know how silly this sounds? Good engineers can work in any language. At the top companies (of which Anthropic is certainly one) they don’t have “C++ engineers” and “rust engineers” they just have engineers.

One of the best Django engineers I ever worked with had hardly any Django or Python experience when we hired them, but had done plenty of Rails.

They were up and running and super-productive with Django within a week.

Re: Claude Code uses Bun written in Rust now

#389

Earlier quoted context omitted.

I'm confused as well, could someone who knows how TUIs work explain what's the point of React-style diffing in this context? I thought you need to clean and full redraw if anything changs anyways?

> I thought you need to clean and full redraw if anything changs anyways? Unless you use an ancient teletype, you don't have to redraw everything. That would make any interactive applications way too slow/flickery. You can move the cursor arbitrarily in the terminal and start overwriting characters from there. So you need to track state to know what is "dirty" and needs refreshing. Occasionally you issue a full redra…

[deleted]

Re: Claude Code uses Bun written in Rust now

#390
post #209

Why all the mess with Bun? Couldn't they have rewritten Claude Code in Rust directly? No more need for a JS runtime, better performance, etc... If their agents can do Zig to Rust, why not JS to Rust?

I know, its so confusing. Its almost as if the bun rewrite to Rust has absolutely fuck all nothing to do with Anthropic's product strategy.

Well, yeah, it's just good marketing and Bun ultimately doesn't matter anyway, not to the wider ecosystem and especially not to Anthropic. The only purpose Bun had for Anthropic was as a way of getting attention, so that's what they used it for.
Post reply on HN