118 comments

[ 4.2 ms ] story [ 111 ms ] thread
I suspect that an experiment is being run. In any case, that'll be a hell of a story!
Why? Are there particular reasons that the maintainers of Bun feel the need to attempt to migrate from Zig to Rust?
So I can't tell if the linked commit is an actual attempt or just an experiment but it did always strike me as odd to make a JS runtime in Zig when my impression was there were a lot of work-stopping compiler bugs at the time.
Interesting to see this when the current top post on HN is someone worrying about Bun as it was acquired by Anthropic. The top comment there describes “Anthropic does experiments on their own codebase, the Bun team is not gonna do the same vibe coding experiments”.

Yet here we are, what looks like a massive undertaking for vibe coding.

Time will tell how this will turn out. Would be nice if the Bun maintainers could give some clarification about what they’re doing here, and why they’re doing this.

To be fair, this seems to be Buns original creator themselves experimenting. Unclear if there's any relation to the Anthropic acquisition. But I think it's best we refrain from prematurely speculating if we just don't know.
"Claude, migrate bun to Rust, make no mistakes"
you can use both zig and rust in a single project, duh
multi-language codebase are a nightmare to work with
instead of writing it once in C++
I'll be very interested in how this AI port turns out. I am involved in a number of active projects that are being held back by the language / framework is holding back the project, but where a rewrite would be too big of a project to undertake by using only human power.

I've had more success vibe coding Rust than I have in more dynamic languages. I suspect the strictness of the Rust compiler forces the AI agent to produce better code. Not sure. It could be just that I am less familiar with Rust so it feels like it's doing a better job.

(comment deleted)
Comparing this claude/phase-a-port branch with main: “Showing 1,646 changed files with 773,950 additions and 151 deletions.”
>*No `tokio`, `rayon`, `hyper`, `async-trait`, `futures`.* No `std::fs`,

I'm not a rust dev but even I kind of notice that tokio is kind of shunned in most projects. Why is that? Is it just bad or what?

Could just be an experiment or something. It's Monday, the week is young
Makes sense on merit. There really isn’t room for Zig when Rust exists, is more ergonomic, and also safe.
Given they have "unlimited" AI usage, do we expect the port to be complete tomorrow?
When I first heard that bun was written in zig, I thought that was an odd choice for such a large project, mostly because the language is "unstable" and is still making significant breaking changes.

I would guess dealing with breaking changes is a big motivation for this.

Linked commit is probably not the most convincing for this tagline. Here's a branch[0] of Claude mass rewriting Zig code into Rust which is currently at 773,950 additions and 151 deletions:

[0]: https://github.com/oven-sh/bun/compare/claude/phase-a-port

Yikes. When Jarred left Stripe for the first time, he left behind multiple 10k+ line PRs rewriting code in the dashboard (this is before LLMs). It took months to work through those. A three quarter million line diff is essentially unreviewable.
Interesting. When I thought of Zig, I thought of Bun. In my mind it was the flagship application for that language. Is there another? I wonder how the Zig team feels about this. To me it seems like Rust has definitively won now.
Interesting how times have changed. Back in 2015, the entire Go runtime (already a mature codebase) was rewritten from C to Go semi-automatically: one of the maintainers wrote a C-to-Go conversion tool (for a subset of C they used) so that it compiled and produced identical output, and then the resulting code was manually refactored to make the Go code more idiomatic and optimized. And now you can just ask a language model.

The slides: https://go.dev/talks/2015/gogo.slide#3

An interesting similarity:

>We had our own C compiler just to compile the runtime.

The Bun team maintain their own fork of Zig too

hahaha eat your heart out "don't port it to rust" gang
This feels more like a reaction to Zig's anti-LLM policy than anything. Anthropic would probably like to contribute something back to Zig at some point, but I doubt anyone would ever believe their PRs were not written by Claude.
(comment deleted)
Any confirmation that a genuine port is underway? This might just be an experiment.
The problem with vibe coded re-writes is that you basically sign off on understanding the generated codebase at that point. Any historical knowledge of the codebase is gone.
This is a huge loss for the zig language and community.

As a fan of the language, I hope it leads to some reflection on things that might need to change moving forward.

Nah, let the Zig foundation cook.

Both their AI policy and their rejection of Bun's performance PR were level-headed and well-reasoned. And the link seems more like a proof-of-concept than anything else.

It's true corporate sponsors are a big help with language development, but not at the expense of conceptual integrity.

I think I agree more with this take than where I started