Hacker News new | ask | show | jobs
by didibus 3074 days ago
Had never heard of zig. Does it also provide memory safety without a GC like Rust?
2 comments

No, not to the same extent.

It attempts to make C-style memory management as safe as possible, and also make it easy to use different memory allocators, but does not attempt advanced techniques like borrow checkers.

There's also a pretty good metaprogramming system, so it may be possible to implement some smart memory-management libraries.

Zig is about simplicity. It's a C (and partly C++) replacement, not a Rust replacement.

Think of it this way: I could easily imagine a TCC-like, dirt-simple, super-fast compiler for Zig. I'm not sure we'll ever see the same for Rust.

That's nothing against Rust, just saying they have very different goals.

"Unsafe Zig" encompasses all of Zig, much like e.g. C.