logoalt Hacker News

wrcwillyesterday at 7:58 PM5 repliesview on HN

can someone explain why zig is often compared to rust?

i understand zig as a better C, but in what world is another memory unsafe language a good idea?

i mean i kinda get if the thing you are writing would require LOTS of unsafe, then zig provides better ergonomics

however most programs can definitely be written without unsafe and in that case i dont get why wed do this to ourselves in 2025

why not take advantage of memory safe, and data race safety?


Replies

whatshisfaceyesterday at 8:01 PM

Memory safety is a gradient. Zig is "memory safe-er" than C just because its arrays store length. Of course, RCE vulnerability is not a gradient.

dnauticsyesterday at 8:05 PM

because rust is more than just memory safety, it's not obvious that "the rust way" is the only way to go. fil-c is a good? example of a alternative strategy. sel4 is a radically different strategy that is as much of a pain in the ass as it's powerful. (disclaimer, i'm working on compile time memory safety for zig)

CamouflagedKiwiyesterday at 9:13 PM

Because both are languages that could feasibly be used to solve a particular set of problems. TigerBeetle could have been written in either, they explain why they didn't choose Rust but it was a feasible alternative (in a way that Java or Python would not have been).

Conceptually C and C++ are also in that potential solution space, but I'm sure they feel that Zig's properties are superior for what they want.

allknowingfrogyesterday at 9:08 PM

The article actually addresses these questions. It's way more than just a donation announcement. It lays out the various reasons that Zig is the language of choice for TigerBeetle.