Hacker News new | ask | show | jobs
by qsort 28 days ago
I agree that the Bun rewrite is much more reasonable than knee-jerk reactions imply, however:

- I don't think Claude Code is using the Rust version yet in their official build

- Claude Code is not a particularly complicated piece of software from an engineering perspective (nor it's particularly well-engineered, at least at the moment).

So in my book "it runs Claude Code" would be pretty weak evidence that the rewrite is going to be successful (the tests they've done are much better evidence, but that's a topic for another time).

2 comments

> - I don't think Claude Code is using the Rust version yet in their official build

No, I'm pretty sure it is, actually, since June 17:

https://code.claude.com/docs/en/changelog#2-1-181

>> Upgraded the bundled Bun runtime to 1.4

Now, Bun 1.4 doesn't seem to officially exist on https://bun.com/blog or https://github.com/oven-sh/bun/releases, so I can't be 100% sure this is the Rust version. However, I have to do some patching of the Claude Code binary to get it to run on my OS, and version 2.1.181 coincided with some changes that make suspect it's using Rust now.

https://news.ycombinator.com/item?id=48609168

https://grigio.org/bun-1-4-the-controversial-ai-driven-rewri...

> 13,044 unsafe blocks in the resulting Rust code (hand-written Rust projects of similar size average ~73)

Grok is this true?

I've heard the meme that AI written rust code is absurdly full and safe blocks but... that's pretty funny.

Hang on. A claim like that can be verified with a single grep! Give me a minute...

    $ rg -U "unsafe\s+\{" . | wc -l
    10551
Hey, that's progress!
> I've heard the meme that AI written rust code is absurdly full and safe blocks but... that's pretty funny.

If I understand what happened here correctly this isn't really a case of any such meme, but the result of the porters (heh) telling the LLM to directly convert zig code using unsafe to match the previous code "exactly".

I.e. more like using the LLM as a fancy version of c2rust [1] (which would result in just as much unsafe) than a result of LLMs reaching for escape hatches too liberally.

[1] https://github.com/immunant/c2rust

It's unironically a good practice when you port from an unsafe language (C/Zig) to Rust. Porting isn't refactoring. One should keep the logic mapping one-to-one as much as possible.

The high number of unsafe blocks is a good sign.

Counting instances of "unsafe {" is pretty useless. Unsafe is needed in "safe" code. What it allows is to create a boundary where the caller is the one that uphelds the contract. If the unsafe is in an internal library, it’s much more difficult to misuse.
This is ironically a skill issue in prompting, especially if they had Fable access - or, more likely, they just really, truly don’t care.
...but isn't Zig code entirely unsafe?

I've never understood why people make fun of Rust code that has lots of unsafe blocks. Obviously, the goal is to reduce those blocks, but consider also the number of safe blocks!

I agree Claude Code is seemingly (currently) not very well-engineered but I think you may be moderately underestimating how complicated it is/necessarily has to be.
What are those complications?

Last I heard Claude Code devs were trying to compare their app to a game engine or rendering system.

This was summarily ridiculed. Are you saying that writing a game engine is easier than writing Claude Code?

There are multiple levels to the irrelevance of your reply.
The irony!
- I agree that trying to hamfist a poorly-engineered game-like rendering engine into Claude Code was not wise - hence my agreement in my initial post that "Claude Code is seemingly currently not very well-engineered".

- All of the stuff unrelated to rendering/display is the complicated stuff I was referring to. It's actually not easy to get an agentic harness (even one with, say, the simplest TUI imaginable) to work as well as Claude Code and Codex do.

- I included "necessarily has to be" to separate the two - it does not necessarily need to have a weird buggy rendering engine thing, it does necessarily need to have lots of careful agentic massaging.

- I do not understand how the implication "writing a game engine is easier than writing Claude Code" could have been drawn from my reply.