logoalt Hacker News

dabinatlast Sunday at 12:50 AM1 replyview on HN

I think that a line-for-line rewrite in Rust like Bun did isn’t really getting all of the benefits of using Rust. A key benefit is utilizing the type system to make the borrow checker work for you by making certain checks happen at compile-time instead of runtime. Making it impossible for certain mistakes to occur is a massive benefit but you need to restructure everything to do so.


Replies

ameliaquiningtoday at 6:43 AM

The Bun rewrite is a long-term investment; the idea is that you initially compromise on idiomatic Rust for the sake of being able to keep shipping, but then the codebase becomes more idiomatically Rust-like over time. It will probably take another year or so to determine whether this works out.

(Note also that Bun inherently needs to use a lot of unsafe because a large fraction of its internal API surface is interlinked deeply and pervasively with that of JavaScriptCore.)