frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

Zig and the design choices within

https://blueberrywren.dev/blog/on-zig/
65•lerno•3h ago

Comments

kace91•1h ago
This article works really well to illustrate a question I have: why is Zig so popular in posts here?

For most languages I can usually see one or two “killer features” that push the language: For Rust is taking C space with memory safety + modern semantics, for Go is being easy to learn by most engineers + parallelization, for Ruby is ergonomics…

I don’t see any similar pitch for zig other than a general “I kinda enjoy it”, and the language seems to have a couple red flags, so why focus on it? (Honest question).

munificent•1h ago
> for Ruby is ergonomics…

My impression is that this is the main thing for Zig too. The intersection of the set of languages that let you write very low-level code where you have full control over memory and allocation and the set of languages that are enjoyable to program in is pretty small.

C is in there if you've internalized many of its warts are fine with all of the many many footguns it has. C++ is in there if you much of your enjoyment comes from the machismo of feeling like you have conquered C++'s beastly language complexity. Rust is in there if proving to the compiler that you know what you're doing is satisfying to you.

Zig sort of gets out of your way like C does, even when what you're trying to do is potentially harmful. But it's more modern and expressive and doesn't have all of C's historical baggage.

xanthor•1h ago
Low abstraction overhead and no ‘big ideas’. It tries to simplify the problem of low-level systems programming by learning from the lessons of the past 50 years.
mtlynch•1h ago
I'm a casual fan of Zig for hobby development, so just as a data point:

I find Zig to be a pleasant option for code that requires high performance. I find it strictly dominates C as an option, as Zig outperforms C on every criteria I care about in a language's developer experience.

I often see people compare Zig to Rust and complain that Zig doesn't have Rust's safety guarantees. I don't know Rust, but looking at it casually, the language itself seems to have a lot of complexity that doesn't appeal to me, and I'd still prefer Zig to Rust. If I need memory safety, I'd rather write in Go or Python.

When I read articles like these, the gotchas they find don't seem that compelling to me. It's always like if you write your code in a deliberately confusing way to confuse the compiler, you can get incorrect results, but I don't care because I would never write code like that.

xlii•1h ago
For me, personally, it is nice because it's bare metal where I want it and not bare metal when I don't.

C is very basic and (especially when you stick to something like C99), can be very tedious to write. In C, if I hope for smarter things I need to write them by hand; usually there are no ways of achieving some goals without just crunching out the code. Zig preserves C qualities but also gives some extra tools that are completely optional and makes it less tedious than C.

I believe that Zig's popularity is also caused by general tendency of some people. Some prefer to fix a segfault than spend half a day refactoring something that was supposed to be easy but is causing half of the codebase to be rewritten.

(Oh, and Zig is also an escape hatch to easy CGo :))

salamanderman•1h ago
I think the post gives an answer to this with "due to Zig's fairly minimalistic nature; it lacks a lot of features that one would otherwise use to solve problems. Of course, this is the appeal for many, but still". I have a lot of C/C++ experience, and they're what I reach for, but I often want C to be a little more like C++, and I often want both to have slightly better memory management, and I've never liked the different syntax for the main language, templates, and pre compiler macros. I also agree with Zig's dogmatic stance on no hidden control flow; I have been bitten by "magic" too many times.
xeonmc•1h ago
Zig for me is “C with namespaces”. Other selling points are just complimentary.
kristoff_it•58m ago
Some people like Zig because it makes it easier to learn how to program the machine sitting in front of them.

It's better at that than Rust because it's less abstracted, and it's better at that than C because you don't have to worry all the toolchain nonsense / weird conventions / weak type system of the C ecosystem.

As a small example wrt Rust: resetting an arraylist/vector while reusing its memory is a weirdly complicated trick https://lobste.rs/s/emvkea/why_we_didn_t_rewrite_our_feed_ha...

I think I don't need to provide references for C.

It's a new pathway to mastery that really works well for some people. That in itself is much more valuable than any new specific feature the language has to offer, although the ability of the toolchain to cross-compile reliably not only Zig but also C and C++ code does play into that.

And, while not yet 100% there, instant incremental rebuilds also help to achieve faster feedback loops.

People like Zig because it's a tool that helps them become better programmers, faster.

pron•18m ago
Turns out that "killer features" are frequently not killer enough. You mentioned Rust with its memory-safety killer-feature, and yet Rust is quite old now (about as old as Java was when JDK 6 came out or JS was when jQuery came out) and its adoption rate is low for such an old language.

I have no idea if Zig will be successful or not, but even if you look just at memory safety, I think it does a better job at that than Rust. If you look at MITRE's top 25 dangerous weaknesses [1] or top 10 exploited weaknesses [2], you'll see that Rust spends almost all of its complexity on eliminating weaknesses that don't even make the top 5 in either list, while Zig's more limited memory safety addresses the more dangerous memory-safety-related problems without paying so dearly to solve less severe issues.

Now, I personally think that Zig's combination of expressivity and simplicity, while still being low-level, is an unprecedented killer feature (I wrote more about it here: https://news.ycombinator.com/item?id=45852774) which makes the language design quite revolutionary and fascinating. This could perhaps translate to correctness benefits.

[1]: https://cwe.mitre.org/top25/archive/2024/2024_cwe_top25.html

[2]: https://cwe.mitre.org/top25/archive/2024/2024_kev_list.html

tayo42•7m ago
With all the hn hype around zig I ended up going through the docs and some example code and felt the same way. I'm not totally sure where this fits into my tool box of languages.
kiitos•1h ago
probably should define memory safety before using it as an evaluation criterion

otherwise, not sure who the audience of this piece is supposed to be, but it's written in a pretty combative tone, which will not be persuasive to anyone who isn't already persuaded, so i guess more of a rant than anything worth sharing here

jasperry•46m ago
Someone could know what memory safety is and still be persuaded (or reminded) by an argument that it's not okay to adopt a non-memory-safe language due to all the security issues. The author did cite evidence from the Chromium project, which to me elevates it above a mere rant.
kiitos•39m ago
my point with memory safety is that it is not a single well defined concept

so if you wanna talk about it you at least gotta say which definition you're using

nightpool•8m ago
I can see where you're coming from, but I do think there's a fair amount of meat here. I've never used Zig, but I initially thought of it as pretty similar to other modern languages like Go and Rust, and I liked their allocator approach, but the post gives compelling statistics (Bun has almost EIGHT times as many crash issues as Deno over a similar number of tickets) on Zig's memory safety approach and its issues that also line up with my experience. I used Bun for a small data-collection project, and I liked its performance, but I ran into a lot of issues with it segfaulting (even when just passing a command line argument that was added in the most recent version!). I think that does a good job of motivating OP's argument and how Zig's language semantics directly contribute to these issues.
anp•1h ago
I find a lot of these points persuasive (and I’m a big Rust fan so I haven’t spent much time with Zig myself because of the memory safety point), but I’m a little skeptical about the bug report analysis. I could buy the argument that Zig is more likely to lead to crashy code, but the numbers presented don’t account for the possibility that the relative proportions of bug “flavors” might shift as a project matures. I’d be more persuaded on the reliability point if it were comparing the “crash density” of bug reports at comparable points in those project’s lifetimes.

For example, it would be interesting to compare how many Rust bugs mentioned crashes back when there were only 13k bugs reported, and the same for the JS VM comparison. Don’t get me wrong, as a Rust zealot I have my biases and still expect a memory safe implementation to be less crashy, but I’d be much happier concluding that based on stronger data and analysis.

pyrolistical•1h ago
The authors section on comptime makes me believe they have not used zig anything non trivial.

I don’t think comptime as just some macro system. It is closer to a reflection system. I use comptime to access types. You can create specialized paths depending on type.

Also imo generics are “first class” in zig. Comptime is first class and thus generics are too.

taylorallred•1h ago
I have admired many parts of Zig and its philosophy but I've never seen it as a language that I want to use. What I've noticed is that Zig users care most about explicitness, simplicity, and minimal indirection. This leads to a lot of syntax that is cumbersome to read (albeit unambiguous) like casting and a lack of "convenience" features. I can't help but think that maybe they're right and that this philosophy probably leads to better software because nothing is "hidden". But, I also think that there's a level of abstraction/indirection that makes code clearer and less error-prone. It's a tricky balance to achieve, and past languages have succeeded and failed at it to different degrees. Either way, I echo the OP's sentiment: if Zig is your jam, great, go make some awesome stuff with it. It's just not my go-to today.
pron•29m ago
Design choices that are appropriate for low-level programming may be less appropriate for high-level programming and vice versa. In low level programming, you may want to see "on the page" anything that could translate to some machine work, because in low-level programming, such details may be essential to the algorithm. In high-level programming, the same details are likely not essential to the algorithm, and so you don't want to see them.
ivanjermakov•1h ago
> Zig's comptime is a very large and all-encompassing feature that ultimately brings very little to the table that smaller features cannot.

> I am personally a proponent of a good macro system.

Comptime is much more constraint than any macro system: no code generation (including AST rewrite), no arbitrary tokens. Thus it's much harder to "go overboard" with Zig's comptime. This constraints of cource have their drawbacks, but code generation is still a thing.

> Much of Zig seems to me like "wishful thinking"; if every programmer was 150% smarter and more capable, perhaps it would work.

Nice way to put it! But I oppositely believe the world needs more tech that treats professionals as experts, not kids.

brabel•27m ago
> Nice way to put it! But I oppositely believe the world needs more tech that treats professionals as experts, not kids.

That’s how it was until around the turn of the century. Who needs types, we’re adults after all. Memory safety and garbage collection? Oh please go back to kindergarten.

But then some of us learned that no matter how smart we are, we can make mistakes that those things can actually prevent. And those mistakes can have catastrophic consequences. Professionals should go for tools that help them prevent those mistakes, right??

ModernMech•20m ago
> But then some of us learned that no matter how smart we are, we can make mistakes that those things can actually prevent.

That's true but it's deeper than that -- no matter how much time goes by, there will always be people new to the language, and they will always make newbie mistakes if the language allows them to. So "just be an expert and don't write shoddy code" doesn't scale, no matter how hard you personally try.

rvrb•18m ago
Zig is a tool that helps professionals prevent those mistakes.

"Memory safe languages" are tools that prevent professionals from making those mistakes.

It's a subtle but important difference. Zig attempts to leave some humanity to the developer.

When someone says they are incapable of earning or deserving that, I feel sad.

Demiurge•1h ago
Why have I been seeing a Zig post every day for the past week? Is there some kind of a marketing push?
zenlot•57m ago
What about more people using it? More than anything this looks to be natural evolution of language.
Zambyte•53m ago
Interest on various topics comes in waves on HN. This week it's Zig, next week it's Scheme, the week after is Erlang, etc. Nothing out of the ordinary.
Joker_vD•30m ago
> Zig does not have a way to iterate through a slice or similar in any way except one-at-a-time forwards. Anything else? You're using a while loop, and you'll enjoy it.

    INCR[U] i FROM 0 TO len(arr) [BY 1] DO ...

    DECR[U] i FROM len(arr) TO 0 [BY 1] DO ...
Although actual BLISS-77 had inclusive semantics for the upper bounds in both forms. Which, on one hand, allows you to write

    DECRU i FROM UINT_MAX TO 0 DO ...
and expect it to Just Work™ (hopefully? No idea if it worked on actual implementation ― but would've been nice, writing the same in e.g. C is kinda annoying; good luck with Golang pre-1.22 and even then, getting that one last iteration is quirky) but on the other hand, inclusive upper bounds require you to write add that "-1" almost everywhere.
brabel•23m ago
That looks a lot like Common Lisp LOOP macro!
Joker_vD•20m ago
Honestly, that's been the standard form of FOR loops since Fortran and Algol-60 until C decided to spice things up.
deepriverfish•17m ago
It's interesting to see how popular Zig is becoming, I thought it would get overshadowed by Rust and it would go nowhere.
guywithahat•7m ago
It's interesting how much Rust has slowed down. There is still some development in linux otherwise people seem to be over it. I think Rust just doesn't offer enough in terms of features, and is overshadowed by languages like Go or C++ in terms of what developers are really looking for. Rust's popularity seems to be dropping or holding steady in indexes like TIOBE, and a lot of big "influencers" seem to be over Rust's hype cycle
pyrolistical•41s ago
But they are not even competitors.

Zig is a better C.

Rust is a better C++.

pron•48s ago
This treatment of memory safety is becoming almost cargo cult at this point. If this were a binary issue, then clearly Rust wouldn't cut it because it is quite common in Rust (much more so than in, say, Java) to rely on unsafe code. So if you think Rust is good at memory safety, that means that you must believe that some level of unsafety is acceptable. The only question is how much, and what you're willing to pay to reduce it.

The reason we care about memory-safety so much, compared to other invariants we'd like our programs to have is because, as the article notes, a very high portion of vulnerabilities are due to memory-safety violations. This is why preventing or reducing such violations is important in the first place.

But if we look at vulnerability rankings [1],[2], we see that Zig's memory safety covers the top weaknesses just as well as Rust, and drastically better than C. The vast difference in the complexity of these two languages is that Rust pays a lot to also prevent vulnerabilities outside the top 5.

So if Rust is good because it eliminates some very common dangerous vulnerabilities thanks to its memory safety, then Zig must also be good for eliminating the same ones. Calling it C-like because it doesn't eliminate some less common/dangerous vulnerabilities just because Rust does, is just a misundertanding of why this is all important in the first place.

In fact, both Rust and Zig address some of the most common/dangerous vulnerabilities — more than use-after-free - just as well as C, which is to say, not, or barely, at all. I.e. there are worse vulnerabilities that neither one of them eliminates than the ones Rust eliminates and Zig doesn't.

[1]: https://cwe.mitre.org/top25/archive/2024/2024_cwe_top25.html

[2]: https://cwe.mitre.org/top25/archive/2024/2024_kev_list.html

Unexpected things that are people

https://bengoldhaber.substack.com/p/unexpected-things-that-are-people
138•lindowe•2h ago•67 comments

Asus Ascent GX10

https://www.asus.com/networking-iot-servers/desktop-ai-supercomputer/ultra-small-ai-supercomputer...
130•jimexp69•3h ago•114 comments

Launch HN: Hypercubic (YC F25) – AI for COBOL and Mainframes

https://www.hypercubic.ai/
36•sai18•2h ago•14 comments

Think Weirder: The Year's Best SciFi Ideas

https://thinkweirder.com
53•mooreds•1w ago•33 comments

Benchmarking leading AI agents against Google reCAPTCHA v2

https://research.roundtable.ai/captcha-benchmarking/
31•mdahardy•2h ago•26 comments

Interesting SPI Routing with iCE40 FPGAs

https://danielmangum.com/posts/spi-routing-ice40-fpga/
71•hasheddan•5h ago•5 comments

Pose Animator – An open source tool to bring SVG characters to life (2020)

https://blog.tensorflow.org/2020/05/pose-animator-open-source-tool-to-bring-svg-characters-to-lif...
90•jerlendds•6d ago•9 comments

Cops Can Get Your Private Online Data

https://www.eff.org/deeplinks/2025/06/how-cops-can-get-your-private-online-data
138•jamesgill•2h ago•34 comments

LLMs are steroids for your Dunning-Kruger

https://bytesauna.com/post/dunning-kruger
121•gridentio•3h ago•84 comments

Time to start de-Appling

https://heatherburns.tech/2025/11/10/time-to-start-de-appling/
164•msangi•4h ago•124 comments

Steven Heller's Font of the Month: Archive Matrix

https://ilovetypography.com/2025/11/07/steven-hellers-font-of-the-month-archive-matrix/
41•baruchel•5h ago•3 comments

Zig and the design choices within

https://blueberrywren.dev/blog/on-zig/
65•lerno•3h ago•32 comments

Staying opinionated as you grow

https://hugo.writizzy.com/being-opinionated/57a0fa35-1afc-4824-8d42-3bce26e94ade
60•hlassiege•5d ago•31 comments

Reminder to passengers ahead of move to 100% digital boarding passes

https://corporate.ryanair.com/news/ryanair-issues-reminder-to-passengers-ahead-of-move-to-100-dig...
50•teekert•3h ago•133 comments

ClickHouse acquires LibreChat, open-source AI chat platform

https://clickhouse.com/blog/librechat-open-source-agentic-data-stack
50•samaysharma•2h ago•18 comments

Installing and using HP-UX 9

https://thejpster.org.uk/blog/blog-2025-11-08/
98•TMWNN•10h ago•42 comments

Beets: The music geek’s media organizer

https://beets.io/
204•hyperific•12h ago•83 comments

Games Preservation Is Hard and Sometimes Involves Private Detectives

https://kotaku.com/gog-preservation-program-private-detectives-drm-2000635611
62•PaulHoule•3h ago•15 comments

Hacker News Headlines (game)

https://projects.peercy.net/projects/hn-oracle/index.html
16•greenwallnorway•1h ago•11 comments

Using the expand and contract pattern for schema changes

https://www.prisma.io/dataguide/types/relational/expand-and-contract-pattern
74•tanelpoder•1w ago•29 comments

Modular monolith and microservices: Modularity is what matters

https://binaryigor.com/modular-monolith-and-microservices-modularity-is-what-truly-matters.html
107•BinaryIgor•6d ago•117 comments

Refashion: Reconfigurable Garments via Modular Design

https://arxiv.org/abs/2510.11941
24•PaulHoule•5h ago•4 comments

Multistable thin-shell metastructures for multiresponsive metabots

https://www.science.org/doi/10.1126/sciadv.adx4359
11•PaulHoule•4h ago•1 comments

Redmond, WA, turns off Flock Safety cameras after ICE arrests

https://www.seattletimes.com/seattle-news/law-justice/redmond-turns-off-flock-safety-cameras-afte...
9•dredmorbius•27m ago•1 comments

DNS Provider Quad9 Sees Piracy Blocking Orders as "Existential Threat"

https://torrentfreak.com/dns-provider-quad9-sees-piracy-blocking-orders-as-existential-threat/
201•gslin•7h ago•91 comments

Show HN: What Is Hacker News Working On?

https://waywo.eamag.me/
195•eamag•4d ago•39 comments

Ask HN: What Are You Working On? (Nov 2025)

344•david927•21h ago•1039 comments

XSLT RIP

https://xslt.rip/
591•edent•11h ago•386 comments

Europe to decide if 6 GHz is shared between Wi-Fi and cellular networks

https://www.theregister.com/2025/11/09/europe_to_decide_if_6/
148•FridayoLeary•8h ago•187 comments

How the UK lost its shipbuilding industry

https://www.construction-physics.com/p/how-the-uk-lost-its-shipbuilding
197•surprisetalk•17h ago•422 comments