Earlier quoted context omitted.
The port was line for line and full of unsafe code. It didn't prevent any bugs. They're not using Rust for its strengths.
The original Zig code is metaphorically one big unsafe block. Even if the Rust port is made up of 3% unsafe blocks, that still means 97% of the original Zig code has been made safe (in the Rust sense).
Buz – A fork of Bun using modern Zig, with sub-1s incremental builds
171–180 of 202 posts
Re: Buz – A fork of Bun using modern Zig, with sub-1s incremental builds
#172Re: Buz – A fork of Bun using modern Zig, with sub-1s incremental builds
#173Re: Buz – A fork of Bun using modern Zig, with sub-1s incremental builds
#174Earlier quoted context omitted.
The port was line for line and full of unsafe code. It didn't prevent any bugs. They're not using Rust for its strengths.
You should give the article[0] a read. "A large percentage of bugs from that list are use-after-free, double-free, and "forgot to free" in an error path. In safe Rust, these are compiler errors and RAII-like automatic cleanup with Drop. Compiler errors are a better feedback loop than a style guide." "At the time of writing, about 4% of Bun's Rust code sits inside an unsafe block (~13,000 unsafe keywords across ~27,00…
Re: Buz – A fork of Bun using modern Zig, with sub-1s incremental builds
#175Earlier quoted context omitted.
The port was line for line and full of unsafe code. It didn't prevent any bugs. They're not using Rust for its strengths.
You should give the article[0] a read. "A large percentage of bugs from that list are use-after-free, double-free, and "forgot to free" in an error path. In safe Rust, these are compiler errors and RAII-like automatic cleanup with Drop. Compiler errors are a better feedback loop than a style guide." "At the time of writing, about 4% of Bun's Rust code sits inside an unsafe block (~13,000 unsafe keywords across ~27,00…
Re: Buz – A fork of Bun using modern Zig, with sub-1s incremental builds
#176Re: Buz – A fork of Bun using modern Zig, with sub-1s incremental builds
#177Earlier quoted context omitted.
That one’s interesting to me because it speaks to both sides of the debate. Yes, safe Rust is good for catching those kinds of errors at compile time. But also, it should theoretically be very easy for a compiler to avoid those problems in Zig, too, if you are using the language the way it wants to be used. Which, from what I’ve experienced so far, does seem to take a whole lot more effort if you’re using a coding ag…
> using the language the way it wants to be used. This sounds like just the coding conventions dependency they're trying to avoid.
LLMs are prediction engines: you can move the needle (heavily) on the predictions from lazy to correct by construction, but the defaults even on high end models like Opus are always riddled with shortcuts.
LLMs can produce coherent & safe Rust 1.92, LLMs can produce coherent Zig 0.16, but that's dependent on in context learning & instruction following.
Re: Buz – A fork of Bun using modern Zig, with sub-1s incremental builds
#178Why is there so much buzz around bun? Can't we just go back to node + npm + vitest + vite?
Re: Buz – A fork of Bun using modern Zig, with sub-1s incremental builds
#179Earlier quoted context omitted.
Since they did a one-to-one translation to start with, hypothetically, if these were the true numbers, you could probably get a static analysis tool to guarantee you that 97% of the zig code was safe and tell you which of the 3% were unsafe. Zig has a lot more syntax and conventions to encourage safe code compare to C after all. It just doesn’t have way to mark which parts are safe or unsafe. An LLM could probably al…
No you cannot get a static analysis tool to guarantee 97% of zig code was safe. Well, you can - the tool is called the borrow checker. Do you know what's infinitely cheaper and faster than an LLM running nightly reviews of all of the code and infact mathematically provable that the code (and any new code) is memory safe? It's called the borrow checker.
(my wip experiment: ) https://github.com/ityonemo/clr