Live data from Hacker News

Zig Guide

zig.guide

11–20 of 60 posts

Re: Zig Guide

#11
post #8

it’s funny how vibes have shifted from Rust to zig now. I wonder what programming language will be the hype in 2026!

To me, it seemed more like Rust and Zig started gaining popularity around the same time, a few years ago. Then people realized that Zig was in a much earlier state of development than they'd assumed, and had barely any resources to get into it, so the mindshare went mostly towards Rust alone. This is Zig is hitting a second wave.

Re: Zig Guide

#12
I love Zig and I love that it’s getting attention, but can someone convince me of its memory safety? One thing that surprised me is that returning pointers to stack-allocated memory doesn’t cause a compiler error — it just segfaults at runtime. This has been an open issue since 2019 [#1].

That, along with the number of memory-related issues in one of Zig’s most popular project, Bun.js [#2], gives me pause.

[#1]: https://github.com/ziglang/zig/issues/2646

[#2]: https://github.com/oven-sh/bun/issues?q=is%3Aissue+segfault

Re: Zig Guide

#13

I love Zig and I love that it’s getting attention, but can someone convince me of its memory safety? One thing that surprised me is that returning pointers to stack-allocated memory doesn’t cause a compiler error — it just segfaults at runtime. This has been an open issue since 2019 [#1]. That, along with the number of memory-related issues in one of Zig’s most popular project, Bun.js [#2], gives me pause. [#1]: http…

Zig is not memory safe, there is no way around it. It's really only as safe as C, with some helpers for making it easier to write safe code. You should really not use Zig unless you are prepared to deal with memory safety on your own. That makes it a good low-level language for system programming, but a VERY bad general purpose language. I'm writing this as a fan of Zig.

Re: Zig Guide

#14

I love Zig and I love that it’s getting attention, but can someone convince me of its memory safety? One thing that surprised me is that returning pointers to stack-allocated memory doesn’t cause a compiler error — it just segfaults at runtime. This has been an open issue since 2019 [#1]. That, along with the number of memory-related issues in one of Zig’s most popular project, Bun.js [#2], gives me pause. [#1]: http…

[deleted]

Re: Zig Guide

#15
post #5

Zig is great, played with it a bit to compile to WASM and found it to be pretty easy to work with. That said, they're not winning on the docs, community and marketing front vs Rust. It's not really apples to apples, but it's a comparison people naturally draw.

For me, it's the library problem. I read the guide and think, "Wow, this is really great!" Then I read the cookbook, and it mostly says that things (like database connectivity, regex, options parsing, even HTTP GET) are not quite ready for prime time, and I should just call out to C. Obviously, it takes time for a language to get there; I don't really mean this as a criticism. But I'm just not interested in wrapping…

Since c abi powers the world, with zig’s ability to easily wrap c libs, not only does zig have access to all libs; it also makes it easy to integrate zig with any existing project as most programming languages have integration with c.

This is why everybody says just use some existing c lib

Re: Zig Guide

#16

I love Zig and I love that it’s getting attention, but can someone convince me of its memory safety? One thing that surprised me is that returning pointers to stack-allocated memory doesn’t cause a compiler error — it just segfaults at runtime. This has been an open issue since 2019 [#1]. That, along with the number of memory-related issues in one of Zig’s most popular project, Bun.js [#2], gives me pause. [#1]: http…

There was a discussion yesterday in which the blog author stated (and elaborated on) "I strongly disagree that Zig is safer than — even — unsafe Rust. Anyone telling you otherwise is either purposefully lying, or ignorant". That has been my experience as well. The sorts of errors I ran into were the same as in my C and HolyC experience, and not the sorts of errors I get with Rust.

Re: Zig Guide

#17

I love Zig and I love that it’s getting attention, but can someone convince me of its memory safety? One thing that surprised me is that returning pointers to stack-allocated memory doesn’t cause a compiler error — it just segfaults at runtime. This has been an open issue since 2019 [#1]. That, along with the number of memory-related issues in one of Zig’s most popular project, Bun.js [#2], gives me pause. [#1]: http…

It’s not memory safe.

People say, “oh, it’s safer than C because tests can warn of missed deinits” but the fact is it isn’t memory safe by design and it’s not a priority for the language.

There are still reasons to use it and there are domains where memory safety isn’t a priority, but memory safety depends on the same mix of linters, code review, simple memory models, a deep understanding of how memory works, minimal dependencies and luck just like in C. Although none of those things will save you on their own or combined. If memory safety is a priority I’d consider other languages.

Re: Zig Guide

#18

I love Zig and I love that it’s getting attention, but can someone convince me of its memory safety? One thing that surprised me is that returning pointers to stack-allocated memory doesn’t cause a compiler error — it just segfaults at runtime. This has been an open issue since 2019 [#1]. That, along with the number of memory-related issues in one of Zig’s most popular project, Bun.js [#2], gives me pause. [#1]: http…

Think Modula-2, Object Pascal safety.

Much better than C will ever be, but still with gotchas like use after free, or hardware mapped variables.

Re: Zig Guide

#19
post #8

it’s funny how vibes have shifted from Rust to zig now. I wonder what programming language will be the hype in 2026!

To me, it seemed more like Rust and Zig started gaining popularity around the same time, a few years ago. Then people realized that Zig was in a much earlier state of development than they'd assumed, and had barely any resources to get into it, so the mindshare went mostly towards Rust alone. This is Zig is hitting a second wave.

It probably just because C++ is more popular than C. Rust is a C++ replacement and zig is a C replacement.

I see zig catching up in popularity because people are appreciating the simplicity it is trying to achieve.

Re: Zig Guide

#20

Earlier quoted context omitted.

To me, it seemed more like Rust and Zig started gaining popularity around the same time, a few years ago. Then people realized that Zig was in a much earlier state of development than they'd assumed, and had barely any resources to get into it, so the mindshare went mostly towards Rust alone. This is Zig is hitting a second wave.

It probably just because C++ is more popular than C. Rust is a C++ replacement and zig is a C replacement. I see zig catching up in popularity because people are appreciating the simplicity it is trying to achieve.

As someone that was around when C started to be adopted in home computers, followed by C++ adoption several years later, and remembers C vs C++ flamewars on USENET, the popularity comparison made me smile.
Post reply on HN