Live data from Hacker News

Zig → Rust porting guide

github.com

311–320 of 592 posts

Re: Zig → Rust porting guide

#315

>*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?

`tokio`, and Rust `futures` in general, are perfectly fine for typical applications.

But as soon as you need something that doesn’t fit neatly into the abstractions they provide, even something as seemingly simple as proactively reusing or cancelling sessions, things quickly become extremely complicated, inefficient, and unreliable.

For high-performance servers, where you really care about raw performance, DoS resistance, and taking advantage of modern kernel features, these abstractions can become a major limitation.

It’s a bit like using an ORM that gives you no easy way to send raw SQL queries. It works fine for common cases, even if it’s not always optimal. But when you really want to take advantage of what the database can do, you usually avoid the ORM.

Re: Zig → Rust porting guide

#316

People are asking why they would switch from zig to rust. I wonder the opposite: why would anyone would use zig over rust?

Yeah, it's not clear. Especially the rise of LLMs is going to chip away Zig's strong points (simplicity at the cost of lesser safety) as time goes on. Which might be a part of why they're so stressed about it.

Re: Zig → Rust porting guide

#317

Why not rewrite claude-code in Rust? So, Anthropic acquires Bun team because claude-code uses Bun. They port Bun from Zig to Rust presumably because Rust "is better" (imagine big air quotes here). Again presumably, they want to make claude-code "better". Why make it so complicated? With all the power of LLMs they have, surely they can make claude-code the best possible by writting it in Rust directly.

"You are absolutely right! Would you like me to delete Bun and rewrite Claude Code in Rust instead?"

Re: Zig → Rust porting guide

#318

Rewriting it using an LLM is one. But did all the contributors became as proficient in Rust as they were in Zig over night as well?

They are owned by Anthropic. They have virtually unlimited Claude credits.

Tell me you've never worked with system languages without telling me you've never worked with system languages (telling claude to "write it in Rust" does not count).

Re: Zig → Rust porting guide

#319
I work on Bun and this is my branch

This whole thread is an overreaction. 302 comments about code that does not work. We haven’t committed to rewriting. There’s a very high chance all this code gets thrown out completely.

I’m curious to see what a working version of this looks, what it feels like, how it performs and if/how hard it’d be to get it to pass Bun’s test suite and be maintainable. I’d like to be able to compare a viable Rust version and a Zig version side by side.

Re: Zig → Rust porting guide

#320

Earlier quoted context omitted.

They recently tried to upstream an improvement to zig, but were prevented from doing so because zig has a hard and fast "no AI code" rule. Whether you think this response is trying to put pressure on zig or whether they're just moving for practical reasons is up to you. It's probably a bit of both.

Not only because the AI part, here's a discussion [0] about it [0] https://ziggit.dev/t/bun-s-zig-fork-got-4x-faster-compilatio...

In the context of this post, that's absolutely hilarious they're vibe-porting their Zig codebase to Rust.

I love Rust, but you couldn't pick a language with slower compile times... XD

Post reply on HN