Live data from Hacker News

How Our Rust-to-Zig Rewrite Is Going

rtfeldman.com

201–210 of 336 posts

Re: How Our Rust-to-Zig Rewrite Is Going

#201

Can anybody explain to me why anthropic bought bun in the first place ?

Nobody can.

"Claude Code uses Bun" is the reason that's given. But even though Anthropic tells us that "coding is solved", instead of rewriting Claude Code in something other than JS, they bought a company that made a JS runtime and then did a mass rewrite of that JS runtime.

Re: How Our Rust-to-Zig Rewrite Is Going

#202

Earlier quoted context omitted.

I get that but there is always node.js

They aren't exactly the same thing, moving to node would be possible but bun does more than node, so you need to replace the whole thing.

Oh for sure. I guess its just as much a Acqui-hire as well as for the tech.

Re: How Our Rust-to-Zig Rewrite Is Going

#203
post #167
post #91

Earlier quoted context omitted.

They are considered in many research labs since Xerox, unfortunately there are still too much anti-GC religion among mainstream devs.

I don’t think there’s too many of us on the ‘GC did nothing wrong’ hill. Reading the average HN opinion, it seems everybody is writing high-performance latency-sensitive systems that would implode if a response would take 1 ms longer than normal.

Sampling bias. Most of the people responding are probably those with a strong opinion because of what they work on. Everyone else is likely relatively indifferent to it.

It is a misconception that GCs only affect latency-sensitive systems. High-performance throughput-optimized systems are also sensitive at ~1µs granularity for different reasons, so GCs are not used there either.

That a GC is adverse to the performance both latency-oriented and throughput-oriented workloads doesn't leave many use cases in "high-performance" systems. Maybe systems that are severely I/O bound but is barely a thing these days.

Re: How Our Rust-to-Zig Rewrite Is Going

#204

>ReleaseSafe catches use-after-free errors through runtime checks which panic if the program tries to use freed memory. I don't know Zig so maybe they know something I don't, but I have seen no evidence that it catches any type of use-after-free including double-free? While writing a blog post (below) I went through the documentation to figure out the possible runtime memory safety checks Zig can insert. The term "us…

I believe you are correct. I think ReleaseSafe just adds bound checking and panics on unreachable code. I don't think Zig offers any temporal memory safety.

Zig does offer some amount of temporal memory safety.

Link: https://zig.guide/standard-library/allocators/

Text:

> The Zig standard library also has a general-purpose debug allocator. This is a safe allocator that can prevent double-free, use-after-free and can detect leaks.

For more detail, see:

https://github.com/ziglang/zig/issues/3180#issuecomment-5284...

Re: How Our Rust-to-Zig Rewrite Is Going

#205
even though I don't use Zig - a few things make me excited.

such as new games that are gonna come - written in Zig - since its more ergonomic than C.

the other side is on the distributed software side of things - we have already seen it with TigerBeetle.

on my own end - probably robotics side.

Re: How Our Rust-to-Zig Rewrite Is Going

#206
post #49

Earlier quoted context omitted.

It's impossible to add a borrow checker to any existing language. The reason Rust has a working borrow checker is because every part of the language from structs, enum, traits, generics and all the way to the syntax itself has been designed to support lifetimes and borrow checking. It's is not something you can just tack on to an existing language without fundamentally changing it.

I wouldn't say it's impossible, rather un-ergonomic. TypeScript can add type information to ordinary JavaScript code via JSDoc comments; the result can both be executed as ordinary JavaScript as-is and type-checked with TypeScript. But it's a huge pain to try to write (and maintain) everything that way, it was supported as a hack to help migrate legacy codebases. You could probably take a similar "the lifetimes are e…

A better comparison would be Python.

The way Python added types is the most disgusting thing imaginable... but it has type hints now, so I guess that makes some people happy.

Re: How Our Rust-to-Zig Rewrite Is Going

#208

Compile times are a really underrated thing. My #1 gripe with C++ is waiting 10 minutes on a build, it absolutely kills flow.

I currently have a problem with Rust that I use Rust-Analyzer for syntax and autocomplete in VS Code and it has to run the compiler when you save a file to "refresh" things.

As you may imagine, this is insanely slow.

So slow that when I switch from a .rs file to a .ts file I feel like I switched computers.

Re: How Our Rust-to-Zig Rewrite Is Going

#209
> I enjoy Rust, I've taught a course on it, and I happily use it daily for my work at Zed. Despite what Internet comments might have us believe, it's extremely normal for one language to be the best fit for one project, while a different language turns out to be the best fit for a different project. One size does not actually fit all!

Amen. I like both Zig and Rust, and if I praise/criticise one of them, people act like I'm "switching", as if they were two exclusionary religions (though I think some people may indeed view them that way).

The stuff on memory safety written in the article is well worth reading, because in a lot of programmer discourse it's talked of as if it's some binary, that Rust Is Memory Safe, and Zig Is Not Memory safe. That's simply not the case.

Re: How Our Rust-to-Zig Rewrite Is Going

#210

Earlier quoted context omitted.

Okay, thanks for debunking all good products, safe houses and clean water. I guess they are just products, houses, and water.

Good for what? A hammer is good for driving a nail, but not good for driving a screw. Safe for what? My house is safe for humans, but not safe for tropical birds. Clean enough for what? Our water is clean enough to wash my ass, but not clean enough to wash a telescope mirror. Sorry but life is not a Disney movie where some things are unequivocally good/safe and other things are unequivocally bad/unsafe. There are gra…

What nail? A hammer is good for driving a nail from the hardware store, but not good for driving a finger nail.

See? I can play stupid word games too.

How tropical are the birds? I'm afraid life isn't a Disney movie where some things are unequivocally tropical/not tropical. How shared is the language? Congratulations on using only two adjectives in your comment besides the ones you're complaining about, but two is greater than zero.

How much your is the house? Do you own it? Without any mortgage or lien?

Post reply on HN