Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It's more of an in-between C and Rust than Go as it is a systems language with no built-in garbage collector for memory management. It has a lot of memory safety features, but it's not as memory safe as Rust. However, it avoids a lot of the complexity of Rust like implicit macro expansion, managing lifetimes, generics and complex trait system, etc. It also compiles much more compactly than Rust, in my experience.

In my mind, it's an accessible systems language. Very readable. Minimal footprint.



> managing lifetimes

If you are not using a GC language, you WILL be managing lifetimes. Rust just makes it explicit, when the compiler can’t prove it’s safe, which Zig, C don't really care.


A better way of saying it is that Rust makes lifetimes implicit (by default), but in some cases it is necessary to manually manage lifetimes in Rust, when there's ambiguity the compiler can't resolve on its own.

In Zig and C, it's always expected that you will explicitly manage your lifetimes. Zig uses the allocator interface to explicitly allocate new buffer or heap values and its keyword 'defer' to clean up allocated variables after the scope exits so that allocations and frees generally live next to each other.

C on the other hand, is relatively unopinionated about how lifetimes are managed. The defer keyword honestly takes most of the pain of managing lifetimes away.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: