Live data from Hacker News

Why is Zig so cool?

nilostolte.github.io

151–160 of 527 posts

Re: Why is Zig so cool?

#151
post #15

I totally vibe with the intro but then the rest of the article goes on to be a showcase bits of zig. I feel what is missing is how each feature is so cool compared to other languages. As a language nerd zig syntax is just so cool. It doesn’t feel the need to adhere to any conventions and seems to solve the problems in the most direct and simple way. An example of this declaring a label and referring to a label. By mo…

matklad did it justice in his post here, in my opinion https://matklad.github.io/2025/08/09/zigs-lovely-syntax.html

Thread: https://news.ycombinator.com/item?id=44855881

Re: Why is Zig so cool?

#152
post #6

> I can’t think of any other language in my 45 years long career that surprised more than Zig. I can say the same (although my career spans only 30 years), or, more accurately, that it's one of the few languages that surprised me most. Coming to it from a language design perspective, what surprised me is just how far partial evaluation can be taken. While strictly weaker than AST macros in expressive power (macros ar…

Well put. The majority of language development for the last 20 years has proceeded by adding more features into languages, as they all borrow keywords and execution semantics from each other. It's like a neighborhood version of corporate bureaucracies, where each looks across the street, and decides "they've got a department we don't have, we better add one of those".

I like languages that dare to try to do more with less. Zig's comptime, especially the way it supplants generics, is pretty darn awesome.

I was having a similar feeling with Elixir the other day, when I realized that I could built every single standard IPC mechanism that you might find in something like python.threading (Queue, Mutex, RecursionLock, Condition, Barrier, etc) with the Erlang/Beam/Process mailbox.

Re: Why is Zig so cool?

#153
Some days ago I decided to look at Zig a bit more in detail. So I skipped the usual marketing and I checked why it could be an alternative to C or Rust. Could it be?

It seems that (debug) allocators are a nice idea, however, it seems that they exist "somehow" already for C, so I wonder: why would you pick this language for your next low level program? They provide runtime checks, so you need thorough testing before you can spot use-after-free or so. It's very similar to the existing situation with c/c++ and the sanitizers, although they work a bit differently.

So the question I have for hardcore low level programmers: why don't they invest more on the memory allocators like hardened_malloc[0] instead of starting a new programming language? It would probably be less expensive in terms of time and would help fix existing software.

[0]: https://github.com/GrapheneOS/hardened_malloc

Re: Why is Zig so cool?

#154
post #83

In my opinion the biggest issue of Zig is that it doesn't allow attaching data to error. The error can only be passed via side channel, which is inconvenient and ENOURAGES TOOL DEVELOPERS TO NOT PASS ERROR DATA, which greatly increase debugging difficulty. Somethings there are 100 things that possibly go wrong. With error data you can easily know which exact thing is wrong. But with error code you just know "somethin…

This seems kinda contrived. In practice that "ERROR DATA" tends not to exist. Unexpected errors almost never originate within the code in question. In basically all cases that "ERROR DATA" is just recapitulating the result of a system call, and the OS doesn't have any data to pass. And even if it did, interpreting the error generally doesn't every work with a microscope over attached data. You got an error from a wri…

Error data should specify where the error occurred and what failed. So you'll know which file had a problem, and that the problem in question was a failure to write. From that you can make the inference that maybe the disk is full, etc.

Re: Why is Zig so cool?

#155

I'm afraid this article kinda fails at at its job. It starts out with a very bold claim ("Zig is not only a new programming language, but it’s a totally new way to write programs"), but ends up listing a bunch of features that are not unique to Zig or even introduced by Zig: type inference (Invented in the late 60s, first practically implemented in the 80s), anonymous structs (C#, Go, Typescript, many ML-style langua…

[flagged]

I use Lua in 2025, it’s brilliant.

By the way, so does everyone using neovim.

Re: Why is Zig so cool?

#157
post #8

A neat little thing I like about Zig is one of the options for installing it is via PyPI like this: https://pypi.org/project/ziglang/ pip install ziglang Which means you don't even have to install it separately to try it out via uvx. If you have uv installed already try this: cd /tmp echo '#include int main() { printf("Hello, World!"); return 0; }' > hello.c uvx --from ziglang python-zig cc /tmp/hello.c ./a.out

I wish we had that for Nim too!

Re: Why is Zig so cool?

#158
Unfortunately the article glosses too quickly over aspects which seem unique. For instance, I don't get what labeled breaks have to do with comp-time or why a labeled break was used in this situation over a normal function call:

>>>

Labeled breaks

Zig can do many things in compilation time. Let’s initialize an array, for example. Here, a labelled break is used. The block is labelled with an : after its name init and then a value is returned from the block with break.

>>>

The article hasn't even talked about how the language decides what an open curly brace is causing.

Re: Why is Zig so cool?

#159

Earlier quoted context omitted.

Sometimes if a joke doesn't land, it's because the joke wasn't funny. (Also, yes, a lot of folks here are autistic, maybe cool it with the veiled insults.)

Sure sometimes... other times you get deadpan replies unironically demanding citations and proof of claims. There's nothing veiled or an insult: what I mentioned is a real factor in why people would read that statement and jump to demanding proof. - If I told a room full of plumbers that Sharkbites are actually sponsored by big Water trying to encourage water wastage, it definitely might not land... but none of them…

You truly don't see how "you didn't get my joke because you're autistic" is not an insult, to people who did you the courtesy of assuming good faith? Not to drag this out, and I don't personally have an autism diagnosis, but seriously this is no way to act in a space where autism is overrepresented.

Re: Why is Zig so cool?

#160

I'm afraid this article kinda fails at at its job. It starts out with a very bold claim ("Zig is not only a new programming language, but it’s a totally new way to write programs"), but ends up listing a bunch of features that are not unique to Zig or even introduced by Zig: type inference (Invented in the late 60s, first practically implemented in the 80s), anonymous structs (C#, Go, Typescript, many ML-style langua…

D has had compile time function execution since 2007 or so. https://dlang.org/spec/function.html#interpretation It doesn't need a keyword to trigger it. Any expression that is a const-expression in the grammar triggers it.

But Zig doesn't need a keyword to trigger it either? If it's possible at all, it will be done. The keyword should just prevent run-time evaluation. (Unless I grossly misunderstood something.)
Post reply on HN