Live data from Hacker News

Claude Code uses Bun written in Rust now

simonwillison.net

681–690 of 920 posts

Re: Claude Code uses Bun written in Rust now

#681
post #663

Earlier quoted context omitted.

Can you elaborate on the unusual part?

All necessary memory is allocated at initialization. The application is not allowed any allocations during it's normal runtime. This is how it avoid memory bugs. Not a lot of people write programs this way.

A lot of people write software like this when predictable latency is a hard requirement.

Re: Claude Code uses Bun written in Rust now

#682
post #646

Bah. Personally my take on the entire affair is quite negative, whatever Jarred or Simonw says about it. I think Bun owned by Anthropic and the entire rewrite with AI is not the real point (even if it's quite interesting, though). My take is that Jarred, and Bun,didn't demonstrate a serious, adult approach, from "this is my branch, you are overreacting" message to just proceeding with a 1mil+ PR merged in less than m…

It really does seem like they should have been able to do an incremental rewrite with FFI. Could have easily done it with AI too.

Yes, they probably don't know C ABI.

Re: Claude Code uses Bun written in Rust now

#683

Earlier quoted context omitted.

1. No, you're not writing code you don't have to. It's not different to implementing this as non-virtual methods, in fact I'd argue doing simple functions is more straightforward. 2. And the code being compiled is abstract & generic, it won't be instantiated for every type and bloat the executable or instruction cache. 3. Security concerns: With C++ virtual methods every object carries a mutable pointer too (to a vta…

Re #3: vtable pointers aren't mutable...?

Of course they are. The pointers to the vtable are part of the object. They aren't mutable fields as per the language, but for security concerns it doesn't matter what the language thinks. Being part of the object, the vtable pointer has to live in a writeable memory mapping (like stack / heap).

Re: Claude Code uses Bun written in Rust now

#684

Earlier quoted context omitted.

Yes, in the Monaco editor ( https://microsoft.github.io/monaco-editor/ ). It's not just typechecking, the typescript library is also the reference parser for TypeScript and reference emit. Emitting JS from TypeScript is non-trivial and non-local. It's not just in browsers, you might want to run the typescript library on the edge or in some restricted environment where JS/WASM is OK but native code is not. You may wan…

NodeJS can strip types internally without a straight TS dependency. I don’t think this matters, TS was a huge bottleneck for many build pipelines because it never parallelized well

Type stripping is not the same as emit, it only gets you a subset of TypeScript. Fine if you're running your own code, not fine if you want to run arbitrary TypeScript.

Re: Claude Code uses Bun written in Rust now

#685
post #663

Earlier quoted context omitted.

Can you elaborate on the unusual part?

All necessary memory is allocated at initialization. The application is not allowed any allocations during it's normal runtime. This is how it avoid memory bugs. Not a lot of people write programs this way.

This is standard practice in the games industry.

Re: Claude Code uses Bun written in Rust now

#686

Earlier quoted context omitted.

If you can lock down a test suite that ensures parity, then who cares what shape the lift ultimately looks like. A full rewrite in different language that fails to be idiomatic is a step backward operationally, even if you stand to gain on issues the new language just eats for free

I like your fair-mindedness but for folks who are anti-LLM-anything, your argument is not the point. Evidence: see the amount of nonsense in the postgres rewritten in Rust story - https://news.ycombinator.com/item?id=48841676 where there are two contradictory claims made: "postgres is so stable I will never trust a rewrite." "covering 100% of postgres regression suite doesn't guarantee you have replicated every behav…

> If you are depending on some behavior not covered in the regression tests, how do you know the next minor release won't break you?

Decades of intrinsic knowledge. Which a rewrite lacks.

imho the issue is the language used. AI rewrites are cheap and cheap exercises require a great deal of scrutiny and proof of correctness. Simply using regressions test lacks the intrinsic knowledge of a decades old codebase stuck in developers minds.

Claiming a rewrite is better because it passes all tests is a flex, a new version requires a boatload of evidence for people to accept it as an improvement and not just "passes tests, written in rust via LLM so it must be better". Run it in production for a year in a sufficiently large system and you might be somewhere.

Re: Claude Code uses Bun written in Rust now

#687

Earlier quoted context omitted.

You think it’ll all stay there? Of course they’ll iterate and remove the unsafe bits which were necessary for the transition

Except the transition was never necessary. Yet another Anthropic marketing effort so they could claim a shallow victory [0]. [0] https://andrewkelley.me/post/my-thoughts-bun-rust-rewrite.ht...

Creator of language has opinions on big project moving off language.

News at 11.

Re: Claude Code uses Bun written in Rust now

#688
post #639

Earlier quoted context omitted.

I think the main issue is that Bun relies heavily on existing C++ libraries like JavascriptCore, and these require RAII and ref-counting semantics from C++ that are closer to Rust than Zig. You could write a JS engine with Zig-like idioms (arena allocation, static initialization), but that would require re-writing the whole JS engine from the ground-up (though I would definitely be interested in it if someone actuall…

Why not using Swift?

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.

Re: Claude Code uses Bun written in Rust now

#689

Earlier quoted context omitted.

If you can lock down a test suite that ensures parity, then who cares what shape the lift ultimately looks like. A full rewrite in different language that fails to be idiomatic is a step backward operationally, even if you stand to gain on issues the new language just eats for free

I like your fair-mindedness but for folks who are anti-LLM-anything, your argument is not the point. Evidence: see the amount of nonsense in the postgres rewritten in Rust story - https://news.ycombinator.com/item?id=48841676 where there are two contradictory claims made: "postgres is so stable I will never trust a rewrite." "covering 100% of postgres regression suite doesn't guarantee you have replicated every behav…

I think what folks want, but aren't quite able to articulate, is an ongoing community and effort that indicate a project will be healthy and maintained. We want to be able to rely upon the software that we are choosing to use.

Regardless of the technical choices, whether Rust is better or worse, whatever -- pgrust popped into existence thanks to one person driving an LLM through 7000 commits in ~2 weeks. It produced something that passes the regression tests. Even as an LLM-sceptic, I think that's amazing.

From that point, though, it appears to have been completely abandoned. There hasn't been a commit in a month, other than a brief tweak and a note that an as-yet unpublished version that's even betterer is in the works. IDK. I don't think we've acclimated to the shock of the change LLMs create, but if the outcome is a forest of exciting new projects that have a bus factor of 1 and little to no collaboration, I think that's a disservice to this profession.

Re: Claude Code uses Bun written in Rust now

#690
post #194

Earlier quoted context omitted.

"Vibecoded" is not an accurate description of what actually happened. LLMs are extremely good at porting code from one language to another while preserving semantics. Which is why how everything turned out so well was not very surprising.

"Preserving semantics" by casting pointers to aliasing refs in Rust, ignoring lints and errors in the process. Can't help laughing at this point.

You didn't read the blog post at all did you? Clearly you have zero clue what you are talking about.
Post reply on HN