Rewriting Bun in Rust(bun.com)
629 points by afturner 13 hours ago | 368 comments
tl;dr: Bun's creator used Claude (a pre-release "Fable 5" model) to mechanically port Bun's ~535k lines of Zig to Rust over 11 days, aiming to eliminate a recurring class of memory bugs (use-after-free, leaks) that stemmed from mixing GC'd JS values with Zig's manual memory management. The workflow used ~50 parallel loops with strict separation between implementer and adversarial reviewer Claudes (in isolated context windows), compiler errors as a work queue across 64 agents, and Bun's existing TypeScript test suite as language-independent ground truth. All CI shards eventually went green and the rewrite was merged.
HN Discussion:
  • The disciplined AI-assisted rewrite process is impressive and supports memory-safe languages like Rust
  • AI-driven rewrites like this threaten traditional software engineering economics and jobs
  • The rewrite's success reflects poorly on Zig as a language choice
  • The transition was handled unprofessionally, abandoning Zig users and ignoring community concerns
  • ~The cost and Anthropic-insider nature of the rewrite makes the comparison misleading