Back to Home11/16/2025, 7:44:27 PM

Open-source Zig book

690 points
384 comments

Mood

informative

Sentiment

positive

Category

programming

Key topics

Zig

open-source

programming

education

The Hacker News discussion revolves around the announcement of a 62-chapter open-source book on the Zig programming language, available at https://www.zigbook.net. Although there are 38 comments, the top comments are not available, making it difficult to determine the key points and perspectives shared by users. Nevertheless, the discussion likely centers around the book's content, quality, and relevance to the Zig community. Without access to the comments, a more detailed summary is not possible.

Snapshot generated from the HN discussion

Discussion Activity

Very active discussion

First comment

6h

Peak period

146

Day 1

Avg / period

53.3

Comment distribution160 data points

Based on 160 loaded comments

Key moments

  1. 01Story posted

    11/16/2025, 7:44:27 PM

    2d ago

    Step 01
  2. 02First comment

    11/17/2025, 1:25:57 AM

    6h after posting

    Step 02
  3. 03Peak activity

    146 comments in Day 1

    Hottest window of the conversation

    Step 03
  4. 04Latest activity

    11/19/2025, 1:12:05 AM

    14h ago

    Step 04

Generating AI Summary...

Analyzing up to 500 comments to identify key contributors and discussion patterns

Discussion (384 comments)
Showing 160 comments of 384
jesseb34r
2d ago
2 replies
This source is really hard to trust. AI or not, the author has done no work to really establish epistemological reliability and transparency. The entire book was published at once with no history, no evidence of the improvement and iteration it takes to create quality work, and no reference as to the creative process or collaborators or anything. And on top of that, the author does not seem to really have any other presence or history in the community. I love Zig, and have wanted more quality learning materials to exist. This, unfortunately, does not seem to be it.
ncgl
2d ago
1 reply
How do you feel about regular books, whose iterations and edits you dont see?
jesseb34r
2d ago
For books that are published in more traditional manners, digital or paper, there is normally a credible publisher, editors, sometimes a foreword from a known figure, reviews from critics or experts in the field, and often a bio about the author explaining who they are and why they wrote the book etc. These different elements are all signals of reliability, they help to convey that the content is more than just fluff around an attention-grabbing title, that it has depth and quality and holds up. The whole publishing business has put massive effort into establishing and building these markers of trust.
trenchpilgrim
2d ago
1 reply
Do you have any criticism of the content, or just "I don't know the author"?
Brian_K_White
2d ago
They didn't say "this is in error", so they don't need any such example errors.
charlie90
2d ago
3 replies
>Learning Zig is not just about adding a language to your resume. It is about fundamentally changing how you think about software.

Zig is just C with a marketing push. Most developers already know C.

dcre
2d ago
2 replies
I suspect most developers do not know C.
downrightmike
2d ago
5 replies
C is fine C++ is where they jumped the shark
pjmlp
2d ago
Until WG14 ackwnowledges the safety holes in C, isn't fine at all, it should be nuked.
bnolsen
2d ago
C++ explored a lot of ideas that some modern languages borrowed. C++ just had to haul along all the cruft it inherited and built up.
cowsandmilk
2d ago
I’m not sure what that has to do with the comment you’re replying to…
MyOutfitIsVague
2d ago
C++ is far better than C in very many ways. It's also far worse than C in very many other ways. Given a choice between the two, I'd still choose C++ every day just for RAII. There's only so much that we can blame programmers for memory leaks, use-after-free, buffer overflows, and other things that are still common in new C code. At some point, it is the language itself that is unsuitable and insufficient.
jeltz
2d ago
No, C is not fine. It is a really bad language that I unfortunately have to code professionally.
derrida
2d ago
I "know" C, I just can't get it to do anything useful, and segfaults are so lame /s
keyle
2d ago
1 reply
That tagline unfortunately turned me off the book, without even starting to read.

I really don't need this kind of self-enlightenment rubbish.

What if I read the whole book and felt no change?

I think I understand SoA just fine.

xeonmc
2d ago
1 reply
It is also just such an absurdly unziglike thing to state.
Zambyte
2d ago
2 replies
Early talks by Andrew explicitly leaned into the notion that "software can be perfect", which is a deviation from how most programmers view software development.

Zig also encourages you to "think like a computer" (also an explicit goal stated by Andrew) even more than C does on modern machines, given things like real vectors instead of relying on auto vectorization, the lack of a standard global allocator, and the lack of implicit buffering on standard io functions.

I would definitely put Zig on the list of languages that made me think about programming differently.

keyle
2d ago
2 replies
I'm not sure how what you stated is different from writing highly performance C.
budro
2d ago
I think it mostly comes down to the standard library guiding you down this path explicitly. The C stdlib is quite outdated and is full of bad design that affects both performance and ergonomics. It certainly doesn't guide you down the path of smart design.

Zig _the language_ barely does any of the heavy lifting on this front. The allocator and io stories are both just stdlib interfaces. Really the language just exists to facilitate the great toolchain and stdlib. From my experience the stdlib seems to make all the right choices, and the only time it doesn't is when the API was quickly created to get things working, but hasn't been revisited since.

A great case study of the stdlib being almost perfect is SinglyLinkedList [1]. Many other languages implement it as a container, but Zig has opted to implement it as an intrusively embedded element. This might confuse a beginner who would expect SinglyLinkedList(T) instead, but it has implications surrounding allocation and it turns out that embedding it gives you a more powerful API. And of course all operations are defined with performance in mind. prepend is given to you since it's cheap, but if you want postpend you have to implement it yourself (it's a one liner, but clearly more expensive to the reader).

Little decisions add up to make the language feel great to use and genuinely impressive for learning new things.

[1] https://ziglang.org/documentation/master/std/#std.SinglyLink...

Zambyte
14h ago
Consider the following Zig:

    // Vectors have a compile-time known length and base type.
    const a = @Vector(4, i32){ 1, 2, 3, 4 };
    const b = @Vector(4, i32){ 5, 6, 7, 8 };

    // Math operations take place element-wise.
    const c = a + b;
This compiles to this x86-64 code:

    vmovdqa xmm0, xmmword ptr [rip + .LCPI5_0]
    vmovdqa xmmword ptr [rbp - 48], xmm0
    vmovdqa xmm0, xmmword ptr [rip + .LCPI5_1]
    vmovdqa xmmword ptr [rbp - 32], xmm0
    vmovdqa xmm0, xmmword ptr [rip + .LCPI5_2]
    vmovdqa xmmword ptr [rbp - 16], xmm0
C does not provide vector primitive to expose the vector primitives in modern machines. C compilers rely on analyzing loops to see when auto-vectorization is applicable. Auto-vectorization is a higher level of abstraction than directly exposing vector primitives.

Regarding the lack of a standard global allocator, and the lack of implicit buffering on standard io functions, these are simply features of the Zig standard library which are true of computers (computers do not have a standard global allocator nor do they implicitly buffer IO) but are not features of the C standard library, and therefore are not encouraged to use custom allocators or explicit buffering.

jamiejquinn
2d ago
1 reply
Has it changed how you program in other languages? Because that to me is the true mark of a thought-shifting language.
Zambyte
14h ago
The big thing I would say I actually learned and would intentionally apply to other languages is SIMD programming. Otherwise, I'd say it gave me a much clearer mental model of memory management that helps me understand other languages much more fundamentally. Along with getting my hands directly on custom allocators for the first time, a question that took me time to figure out but gave me a lot of clarity in answering was "why can't you do closures in Zig?" Programming in Zig feels very Go-like, and not having closures was actually one of the biggest hiccups for me. I don't think this really changed how I write in other languages, but definitely how I think about other languages.
pjmlp
2d ago
I would rephrase it as, Zig is just Modula-2 with a C like syntax.
zer0x4d
2d ago
2 replies
For me, personally, any new language needs to have a "why." If a new language can't convince me in 1-2 sentences why I need to learn it and how it's going to improve software development, as a whole, it's 99% bs and not worth my time.

DHH does a great job of clarifying this during his podcast with Lex Friedman. The "why" is immediately clear and one can decide for themselves if it's what they're looking for. I have not yet seen a "why" for Zig.

jamiejquinn
2d ago
For many languages I agree, especially languages with steep learning curves (e.g. Rust, Haskell). But zig is dead fast to learn so I'd recommend just nipping through Ziglings and seeing if its a language you want to add to the toolbox. It took me only about 10 hours to pick up and get used to and it has immediately replaced C and C++ in my personal projects. It's really just a safer, more ergonomic C. If you already love C, I maybe wouldn't bother.
anta40
2d ago
Hmmm what about this: https://ziglang.org/learn/why_zig_rust_d_cpp/

Convincing enough?

jimmytucson
2d ago
2 replies
> [Learning Zig] is about fundamentally changing how you think about software.

Learning LISP, Fortran, APL, Perl, or really any language that is different from what you’re used to, will also do this for you.

userbinator
2d ago
1 reply
I'd add Prolog to that list; but Fortran and Perl aren't all that different from other procedural languages.
pjmlp
2d ago
1 reply
Kind of, Perl was one of the first languages to bring FP to the masses, while Lisp and ML languages were hardly looked up by them.

See https://hop.perl.plover.com/book/

hollerith
2d ago
FP as in functional programming?

What about perl is functional?

jamiejquinn
2d ago
I agree, I love zig but the things that make me program differently are features like excellent enum/union support, defer and comptime, which aren't readily available in the other languages I tend to use (C++, Fortran and Python).
poly2it
2d ago
10 replies
> Learning Zig is not just about adding a language to your resume. It is about fundamentally changing how you think about software.

I'm not sure what they expect, but to me Zig looks very much like C with a modern standard lib and slightly different syntax. This isn't groundbreaking, not a throught paradigm which should be that novel to most system engineers like for example OCaml could be. Stuff like this alienates people who want a technical justification for the use of a language.

userbinator
2d ago
4 replies
For those who actually want to learn languages which are "fundamentally changing how you think about software", I'd recommend the Lisp family and APL family.
zwnow
2d ago
2 replies
I'd also throw Erlang/Elixir out there. And I really wished Elm wasn't such a trainwreck of a project...
matu3ba
2d ago
1 reply
What is the most optimal Erlang/Elixir you can think of regarding standardized effect systems for recording non-determinism, replaying and reversible computing? How comparable are performance numbers of Erlang/Elixir with Java and wasm?
zwnow
2d ago
I'd recommend asking the Elixir community about this as I didn't even understand your question. I am by no means a professional with Erlang/Elixir. I threw it out there because these language force you to think differently compared to common OOP languages.
59nadir
2d ago
1 reply
No need to include Elixir here; none of the important bits that will change how you view software come from Elixir, it's just a skin on top of Erlang and that's it.
zwnow
2d ago
1 reply
I'd argue more people use Elixir over Erlang at this point. Sure its just an abstraction on top of Erlang, but people learn through Elixir nowadays, not through Erlang.
59nadir
2d ago
1 reply
If you want to learn the actual mind changing aspects of the BEAM, clearly learning the simpler, smaller language with a more direct route to the juice is the way to go. Hence Erlang, not Elixir.

Also, in practice I would argue that Erlang is better over a longer period of time, but that's a hard sell for most people because it's very hard to accept that newer (and more complex) isn't better.

As a general point I'd like to state that I don't think it really matters what "people" do when you're learning for yourself. In the grand scheme of things approximately no one uses the BEAM, but this doesn't mean that learning how to use it is somehow pointless.

fuzztester
1d ago
1 reply
>actual mind changing aspects of the BEAM

What are those aspects?

newb to this area.

59nadir
1d ago
A few key things:

- Leaning on a pre-emptive scheduler to maintain order even in the presence of ridiculous amounts of threads ("processes" on the BEAM) running

- Using supervision trees to specify how and when processes and their dependents should be restarted

- Using `gen_server` processes as a standard template for how a thread should be running

There's more to mine from using the BEAM, but I think the above are some of the most important aspects. The first two I've never found to be fully replicated anywhere other than in OTP/BEAM. You don't need them, but once you're bought into the BEAM they're incredibly nice to have.

miki123211
2d ago
2 replies
Am I correct that you can essentially "learn APL without learning APL" by just learning Numpy / Pytorch?

I looked at array languages briefly, and my impression was that"ooh this is just Numpy but weirder."

benji-york
2d ago
veqq
2d ago
Not even close. While Numpy has many similar operations, it lacks the terseness, concepts like trains and forks etc. Modern APL style doesn't use... control flow (neither recursion nor loops nor if...) and often avoids variables (tacit/point-free style).
pjmlp
2d ago
And Prolog as well.
fuzztester
2d ago
And Forth.

And 6502 assembly. ;)

And SNOBOL.

And Icon.

And ...

wavemode
2d ago
2 replies
Much of the book's copy appears to have been written by AI (despite the statements that none of it was), which explains the hokey overenthusiasm and exaggerations.
keybored
2d ago
As we know AI is at least as smart as the average human. It knows the Zeitgeist and thus adds “No AI used” in order to boost “credibility”. :) (“credibility” since AI is at least as smart the average human, for us in the know.)
ninetyninenine
2d ago
That's ok, in the near future nobody will actually read this book. AI will be reading it. This is training data.
obviouslynotme
2d ago
5 replies
There is nothing new under the Sun. However, some languages manifest as good rewrites of older languages. Rust is that for C++. Zig is that for C.

Rust is the small, beautiful language hiding inside of Modern C++. Ownership isn't new. It's the core tenet of RAII. Rust just pulls it out of the backwards-compatible kitchen sink and builds it into the type system. Rust is worth learning just so that you can fully experience that lens of software development.

Zig is Modern C development encapsulated in a new language. Most importantly, it dodges Rust and C++'s biggest mistake, not passing allocators into containers and functions. All realtime development has to rewrite their entire standard libraries, like with the EASTL.

On top of the great standard library design, you get comptime, native build scripts, (err)defer, error sets, builtin simd, and tons of other small but important ideas. It's just a really good language that knows exactly what it is and who its audience is.

ninetyninenine
2d ago
1 reply
>Rust is that for C++

No it's not. Rust has roots in functional languages. It is completely orthoganol to C++.

jasode
2d ago
2 replies
Graydon Hoare, a former C++ programmer on Mozilla Firefox and the original creator of Rust, acknowledges that for many people, Rust has become a viable alternative to C++ :

https://graydon2.dreamwidth.org/307291.html

And on slide #4, he mentions that "C++ is well past expiration date" :

https://venge.net/graydon/talks/intro-talk-2.pdf

It's possible that Graydon's earliest private versions of Rust 4 years prior to that pdf were an OCaml language but it's clear that once the team of C++ programmers at Mozilla started adding their influences, they wanted it to be a cleaner version of C++.

ninetyninenine
2d ago
So?

Zig, D, and C are also alternatives to C++. It’s a class of languages that have zero cost abstractions.

Rust is NOT a beautiful language hiding inside of C++. It is not an evolution of C++. I’m pointing out that what you said is objectively wrong.

Can rust replace C++ as a programming language that has a fast performance profile due to zero cost abstractions? Yes. In the same way that Haskell can replace Python, yes it can.

krona
2d ago
> Rust has become a viable alternative to C++

Alternative yes, derivative no. Rust doesn't approach C++'s metaprogramming features, and it probably shouldn't given how it seems to be used. It's slightly self-serving for browser devs to claim Rust solves all relevant problems in their domain and therefore eclipses C++, but to me in the scientific and financial space it's just a better C, solving problems I don't see as particularly relevant.

I say this as a past contributor to the Rust std lib.

renewiltord
2d ago
1 reply
> Most importantly, it dodges Rust and C++'s biggest mistake, not passing allocators into containers and functions

Funny. This was a great sell to me. I wonder why it isn’t the blurb. Maybe it isn’t a great sell to others.

The problem for me with so many of these languages is that they’re always eager to teach you how to write a loop when I couldn’t care less and would rather see the juice.

However, nowadays with comprehensive books like this, LLM tools can better produce good results for me as I try it out.

Thank you.

obviouslynotme
2d ago
Very, very few people outside of foundational system software, HFT shops, and game studios understand why it's a great selling point. Everyone else likes the other points and don't realize the actual selling point of the language.
simonask
2d ago
4 replies
I don't know man, Rust's borrowing semantics are pretty new under the sun, and actually do change the way you think about software. It's a pretty momentous paradigm shift.

Zig is nice too, but it's not that.

rjzzleep
2d ago
6 replies
To call Rust syntax beautiful is a stretch. It seems that way in the beginning but then quickly devolves into a monstrosity when you start doing more complex things.

Zig on the other specifically addresses syntax shortcomings in part of C. And it does it well. That claim of rust making C more safe because it’s more readable applies to Zig more than it does to Rust.

I feel like the reason the rust zealots lobby like crazy to embed rust everywhere is twofold. One is that they genuinely believe in it and the other is that they know that if other languages that address one of the main rust claims without all the cruft gains popularity they lose the chance of being permanently embdedded in places like the kernel. Because once they’re in it’s a decade long job market

hnarn
2d ago
1 reply
> they know that if other languages that address one of the main rust claims without all the cruft gains popularity they lose the chance of being permanently embdedded in places like the kernel

First of all, I'm really opposed to saying "the kernel". I am sure you're talking about the Linux kernel, but there are other kernels (BSD, Windows etc.) that are certainly big enough to not call it "the" kernel, and that may also have their own completely separate "rust-stories".

Secondly, I think the logic behind this makes no sense, primarily because Rust at this point is 10 years old from stable and almost 20 years old from initial release; the adoption into the Linux kernel wasn't exactly rushed. Even if it was, why would Rust adoption in the Linux kernel exclude adoption of another language as well, or a switch to another, if it's better? The fact that Rust was accepted at all to begin with aside from C disproves the assumption, because clearly that kernel is open for "better" languages.

The _simplest_ explanation to why Rust has succeeded is that it's solves actual problems, not that "zealots" are lobbying for it to ensure they "have a job".

throw9404049
2d ago
1 reply
> Rust at this point is 10 years old from stable

Rust is not stable even today! There is no spec, no alternative implementations, no test suite... "Stable" is what "current compiler compiles"! Existing code may stop compiling any day....

Maybe in 10 years it may become stable, like other "booring" languages (Golang and Java).

Rust stability is why Linus opposes its integration into kernel.

bayindirh
2d ago
In the "other good news department", GCC is adding a Rust frontend to provide the alternative implementation, and I believe Rust guys accepted to write a specification for the language.

I'm waiting for gccrs to start using the language, actually.

kibwen
2d ago
1 reply
> if other languages that address one of the main rust claims without all the cruft

But regardless of how much one likes Zig, it addresses none of the problems that Rust seeks to solve. It's not a replacement for Rust at all, and isn't suitable for any of the domains where Rust excels.

sgt
2d ago
3 replies
> and isn't suitable for any of the domains where Rust excels.

That's a pretty bold claim since Zig is specifically designed for systems programming, low level stuff, network services, databases (think Tigerbeetle). It's not memory safe like Rust is, but it comes with constructs that make it simple to build largely memory safe programs.

JuniperMesos
2d ago
2 replies
> It's not memory safe like Rust is, but it comes with constructs that make it simple to build largely memory safe programs.

Right, this is the specific important thing that Rust does that Zig doesn't (with the caveat that Rust includes the `unsafe` mechanism - as a marked, non-default option - specifically to allow for necessary low-level memory manipulation that can't be checked for correctness by the compiler). Being able to guarantee that something can't happen is more valuable than making it simple to do something correctly most of the time.

sgt
2d ago
2 replies
Sure but there's this belief in the Rust community that it's not responsible anymore to write software that isn't memory safe on the same level as Rust.

So Zig would fail that, but then you could also consider C++ unsuitable for production software - and we know it clearly is still suitable.

I predict Zig will just become more and more popular (and with better, although not as complete- memory safety), and be applied to mission critical infra.

pjmlp
2d ago
1 reply
If we ignore recent movents in govermental cybersecurity agencies, and big tech to move away from unsafe programming languages, as much as technically possible.

Introducing a language with the same safety as Modula-2 or Object Pascal, would make sense in the 1990's, nowadays with improved type systems making the transition from academia into mainstream, we (the industry) know better.

It is not only Rust, it is Linear Haskell, OCaml effects, Swift 6 ownership model, Ada/SPARK, Chapel,....

sgt
2d ago
Of those listed, I'd bet Swift (having had experience with it) is the most pleasant to work with. I just hope it takes off on the systems and backend side at some point.
JuniperMesos
1d ago
> So Zig would fail that, but then you could also consider C++ unsuitable for production software - and we know it clearly is still suitable.

Speak for yourself, I never want to write C++ ever again in my life.

I'm not a huge fan of the language of responsibility. I don't think there should be a law banning the use of C or C++ or any other programming language on account of it being unsafe, I don't think that anyone who writes in C/C++ is inherently acting immorally, etc.

What I do think is that Rust is a better-designed language than C or C++ and offers a bunch of affordances, including but not limited to the borrow checker, unsafe mode, the type system, cargo, etc. that make it easier and more fun for programmers to use to write correct and performant software, most of the time in most cases. I think projects that are currently using C/C++ should seriously consider switching off of them to something else, and Rust is an excellent candidate but not the only candidate.

I think Zig is also almost certainly an better language than C/C++ in every respect (I hedge more here because I'm less familiar with Zig, and because it's still being developed). Not having as strong memory safety guarantees as Rust is disappointing and I expect that it will result in Zig-written software being somewhat buggier than Rust-written software over the long term. But I am not so confident that I am correct about this, or that Zig won't bring additional benefits Rust doesn't have, that I would argue that people shouldn't use Zig or work on languages like Zig.

dns_snek
2d ago
3 replies
[delayed]
goku12
2d ago
1 reply
> And while I don't have enough experience with Rust to claim this first hand, my understanding is that writing correct unsafe Rust code is at least an order of magnitude harder than writing correct Zig code due to all of the properties/invariants that you have to preserve.

How do you make such boldly dismissive assertions if you don't have enough experience with Rust? You are talking as if these invariants are some sort of requirements/constraints that the language imposes on the programmer. They're not. It's a well-known guideline/paradigm meant to contain any memory safety bugs within the unsafe blocks. Most of the invariants are specific to the problem at hand, and not to the programming language. They are conditions that must be met in any language - C and Zig are no exceptions. Failure to adhere to them will land you in trouble, no matter what sort of safety your language guarantees. They are often talked about in the context of Rust because the ones related to memory-unsafe operations can be tackled and managed within the small unsafe blocks, instead of being sprawling it throughout the code base.

> So it comes with serious drawbacks, it's not just a quick "opt out of the safety for a bit" switch.

Rust is not the ultimate solution to every problem in the world. But this sort of exaggeration and hyperbole is misleading and doesn't help anyone choose any better.

dns_snek
2d ago
[delayed]
ViewTrick1002
2d ago
1 reply
I would compare the recent Rust Android post [1], where they have a 5000x lower memory vulnerability rate compared to traditional C/C++ with the number of segfaults found in Bun. [2]

I would say that Zig does not move the needle on real safety when the codebase becomes sufficiently complex.

[1]: https://security.googleblog.com/2025/11/rust-in-android-move...

[2]: https://github.com/oven-sh/bun/issues?q=segfault%20OR%20segm...

dns_snek
2d ago
[delayed]
JuniperMesos
1d ago
> And while I don't have enough experience with Rust to claim this first hand, my understanding is that writing correct unsafe Rust code is at least an order of magnitude harder than writing correct Zig code due to all of the properties/invariants that you have to preserve. So it comes with serious drawbacks, it's not just a quick "opt out of the safety for a bit" switch.

I think this is hard to generalize about. There are many instances where one might want to do unsafe memory operations in rust, with different correctness implications. I am suspicious that in Zig you do actually have to preserve all the same properties and invariants, and there's just nothing telling you if you did so or not or even what all of them are, so you don't know if your code is correct or not.

GuB-42
2d ago
1 reply
Rust is not designed for low level system programming / embedded systems like Zig is. It is designed to make a browser and software that share requirements with making a browser.

There is some overlap but that's still different. The Zig approach to memory safety is to make everything explicit, it is good in a constrained environment typical of embedded programming. The Rust approach is the opposite, you don't really see what is happening, but there are mechanisms to keep your safe. It is good for complex software with lots of moving parts in an unconstrained environment, like a browser.

For a footgun analogy, one will hand you a gun that will never go off unless you aim and pull the trigger, so you can shoot your foot, but no sane person will. It is a good sniper rifle. The Rust gun can go off at any time, even when you don't expect it, but it is designed in such a way that it will never happen when it is pointed at your foot, even if you aim it there. It is a good machine gun.

Ygg2
2d ago
1 reply
> Rust is not designed for low level system programming / embedded systems like Zig is.

Pray tell, with Rust already being used in kernels, drivers, and embedded what makes Zig better suited for low-level systems?

More chance to explode a UB in your hand? For that, there is C.

GuB-42
2d ago
1 reply
Great C interop, first class support for cross-compilation, well suited for arena allocators.

You can use Rust in kernel/embedded code, you can also use C++ (I did) and even Java! but most prefer to use C, and I think that Zig is a better alternative to C for those in the field.

There is still one huge drawback with Zig and that's maturity. Zig is still in beta, and the closest you get to the metal, the more it tends to matter. Hardware projects typically have way longer life cycles and the general philosophy is "if it ain't broke, don't fix it". Rust is not as mature as C by far, there is a reason C is still king, but at least, it is out of beta and is seeing significant production use.

I remember when I talk about Zig to the CTO of the embedded branch of my company. His reaction was telling. "I am happy to hear someone mention Zig, it is a very interesting language and it is definitely on my watch list, but not mature enough to invest in it". He was happy that I mentioned Zig because in the company, the higher ups are all about Rust because of the hype, even though we do very little of if BTW, it is still mostly C and C++. And yeah, hype is important, customers heard about Rust as some magical tech that will make the code bug-free, they didn't hear about Zig, so Rust sells better. In the end, they go for C anyways.

Ygg2
1d ago
> Great C interop, first class support for cross-compilation, well suited for arena allocators.

C interop and arena allocators aren't hard requirements for a kernel language. In fact, why would a kernel in <INSERT LANG> need to talk to C? You need it to talk to Assembly/Machine code, not C.

It helps if it can talk to/from C but it's not a requirement.

> customers heard about Rust as some magical tech that will make the code bug-free

That's on customers not having a clear picture. What we can look at experimentally is that yes, Rust will remove a whole suite of bugs, and no, Zig won't help there. Is Zig better than C? Sure, but so is C++ and it still sucks at it.

Like, the few big things wrong with Rust is probably compilation speed and async needing more tweaks (pinned places ergonomics, linear types to deal with async drop...) to make it way better.

ViewTrick1002
2d ago
1 reply
Given the density of memory issues in the Bun issue tracker I have a hard time squaring the statement that Zig makes it "easy" to build memory safe programs.

https://github.com/oven-sh/bun/issues?q=segfault%20OR%20segm...

nvlled
2d ago
1 reply
> https://github.com/oven-sh/bun/issues?q=segfault%20OR%20segm...

It should be noted that most of those issues are created by opening a link that bun creates when it crashes, they are not yet reviewed/confirmed and most likely a lot of them are dulplicates of the same issue.

ViewTrick1002
2d ago
Comparing Deno most of their segfaults come from having to integrate with V8, and their density is a fraction.
latexr
2d ago
1 reply
> To call Rust syntax beautiful is a stretch.

I don’t see where the comment you’re replying to does that (was it edited?). Their comment says nothing about aesthetics.

fransje26
2d ago
1 reply
Higher up

> Rust is the small, beautiful language hiding inside of Modern C++

ModernMech
2d ago
That says Rust is beautiful, not its syntax.
bayindirh
2d ago
> To call Rust syntax beautiful is a stretch.

I'm no Rust fan, but beauty of a syntax is always in the eye of the beholder.

I personally find Go, C++ and Python's syntax beautiful. All can be written in very explicit or expressive forms. On the other hand, you can hide complexity to a point.

If you are going to do complex things in a compact space, you'll asymptotically approach Perl or PCRE. It's maths.

All code is maths, BTW.

andy12_
2d ago
For my part, I don't know why, but Zig's syntax feels wrong to me. I don't even know why. I really want to like its syntax, as Zig seems really promising to me, but I just don't, which makes it not very enjoyable for me to write.

I don't know if it's my lack of practice, but I never felt the same about, say, Rust's syntax, or the syntax of any other language for that matter.

keybored
1d ago
> I feel like

Needless flame bait follows.

hu3
2d ago
1 reply
There were languages with lifetimes and borrowing mechanics before Rust. Rust packages these mechanics in a nice way. Just like Zig encodes many niceties in a useful C language (comptime, simple cross-compilation, stdlib).
brabel
2d ago
1 reply
Which ones?? Before Rust, to my knowledge, no language had an actually practical way to use lifetimes and borrow-checking in such a way that both memory safety and concurrency safety (data races, which is huge) were solved, even though the concepts were known in research. Doing the actual work to make it practical is what makes the difference between some obscure research topic and a widely used language that actually solves serious problems in the real world.
pjmlp
2d ago
1 reply
Cyclone for one, which AT&T created exactly to replace C.
brabel
2d ago
1 reply
Yeah but is that a practical language people can use instead of C and Rust? I’ve always heard of it only as a research language that inspired rust but nothing else.
pjmlp
2d ago
Outside AT&T until they ramped down the project, I guess not, Rust also took its time to actually take off beyond Mozilla, and is around because it was rescued by big tech (Amazon, Google, Microsoft,...) hiring most of the core team.
pjmlp
2d ago
1 reply
Kind of, https://en.wikipedia.org/wiki/Cyclone_(programming_language)

What it has achieved is making affine types something mainstream developers would care about.

Ygg2
2d ago
1 reply
That kind of is a bit load bearing. The differences are pretty huge. Plus, borrow checker is nowhere to be found. Cyclone is more C with a few tweaks (tagged unions, generics, regions, etc.).
pjmlp
2d ago
1 reply
Borrow checking is basically synonym for affine type system.
Ygg2
1d ago
> Borrow checking is basically a synonym for affine type system.

No? It's more akin to flow analysis with special generic types called lifetimes.

> The same outcome can be achieved via affine types, linear types, effects, dependent types, regions, proofs, among many other CS research in type systems.

Sure, and sounds, colors, and instruments are the same, but they are mixed to create an audio-video song. I'm not saying that what Rust did is something that came about ex nihilo, without precedence.

But having it all unified in a unique way that is, is frankly revolutionary.

bayindirh
2d ago
> actually do change the way you think about software. It's a pretty momentous paradigm shift.

That's true for people who doesn't read and think about the code they write. For people who think from the perspective of a computer, Rust is "same checks, but forced by the compiler".

Make no mistake, to err is human, but Rust doesn't excite me that much.

pron
2d ago
2 replies
Describing Zig as a "rewrite of C" (good or otherwise) is as helpful as describing Python as a rewrite of Fortran. It does share some things with C - the language is simple and values explicitness - but at its core is one of the most sophisticated (and novel) programming primitives we've ever seen. After all, the language is as expressive as C++.

> Most importantly, it dodges Rust and C++'s biggest mistake, not passing allocators into containers and functions

I think that is just a symptom of a much bigger mistake shared by C++ and Rust, which is a belief (that was, perhaps, reasonable in the eighties) that we could and should have a language that's good for both low-level and high-level programming, and that resulted in compromises that disappoint both.

LexiMax
1d ago
1 reply
To me, the fact that Zig has spent so long in development disqualifies it as being a "rewrite of C."

To be clear, I really like Zig. But C is also a relatively simple language to both understand and implement because it doesn't have many features, and the features it does have aren't overly clever. Zig is a pretty easy language to learn, but the presence of comptime ratchets up the implementation difficulty significantly.

A true C successor might be something like Odin. I am admittedly not as tuned into the Odin language as I am Zig, but I get the impression that despite being started six months after Zig, the language is mostly fully implemented as envisioned, and most of the work is now spent polishing the compiler and building out the standard library, tooling and package ecosystem.

pron
1d ago
I don't think it's the implementation that's delaying Zig's stabilisation, but the design. I'm also not sure comptime makes the implementation tricky at all. Lisp macros are more powerful than comptime (comptime is weaker by design) and they don't make Lisp implementation complicated.
keybored
1d ago
1 reply
> Zig does share some things with C - the language is simple and values explicitness - but at its core is one of the most sophisticated (and novel) programming primitives we've ever seen: A general and flexible partial evaluation engine with access to reflection.

To my understanding (and I still haven’t used Zig) the “comptime” inherently (for sufficiently complex cases) leads to library code that needs to be actively tested for potential client use since the instantiation might fail. Which is not the case for the strict subset of “compile time” functionality that Java generics and whatnot bring.

I don’t want that in any “the new X” language. Maybe for experimental languages. But not for Rust or Zig or any other that tries to improve on the mainstream (of whatever nice) status quo.

pron
1d ago
1 reply
> leads to library code that needs to be actively tested for potential client use since the instantiation might fail

True, like templates in C++ or macros in C. Although the code is "tested" at compile time, so at worst your compilation will fail.

> I don’t want that in any “the new X” language

Okay, and I don't want any problem of any kind in my language, but unfortunately, there are tradeoffs in programming language design. So the question is what you're getting in exchange for this problem. The answer is that you're getting a language that's both small and easy to inspect and understand. So you can pick having other problems in exchange for not having this one, but you can't pick no problems at all. In fact, you'll often get some variant of this very problem (e.g. in Rust).

In Java, you can get by with high-level abstractions because we have a JIT, but performance in languages that are compiled AOT is more complicated. So, in addition to generics, low-level languages have other features that are not needed in Java. C++ has templates, which are a little more general than generics, but they can fail to instantiate, too. It also has preprocessor macros that can fail at compile-time in a client program. Rust has ordinary generics, which are checked once, but since that's not enough for a low-level language, it also has macros, and those can also fail to instantiate.

So in practice, you either have one feature that can fail to instantiate in the client at compile time, or you can have the functionality split among multiple features, resulting in a more complicated language, and have some of those features display the same problem.

keybored
18h ago
1 reply
I wasn’t clear then. I would rather have N language features of increasing complexity/UX issues for dealing with increasingly complex situations rather than one mechanism to rule them all that can fail to instantiate in all cases (of whatever complexity). That’s the tradeoff that I want.

Why? Because that leads to better ergonomics for me, in my experience. When library authors can polish the interface with the least powerful mechanism with the best guarantees, I can use it, misuse it, and get decent error messages.

What I want out of partial evaluation is just the boring 90’s technology of generalized “constant folding”.[1] I in principle don’t care if it is used to implement other things... as long as I don’t have surprising instantiation problems when using library code that perhaps the library author did not anticipate.

[1]: And Rust’s “const” approach is probably too limited at this stage. For my tastes. But the fallout of generalizing is not my problem so who am I to judge.

> Okay, and I don't want any problem of any kind in my language, but unfortunately, there are tradeoffs in programming language design.

I see.

> So in practice, you either have one feature that can fail to compile in the client, or you can have the functionality split among multiple features, resulting in a more complicated language,

In my experience Rust being complicated is more of a problem for rustc contributors than it is for me.

> and still have some of those features exhibit the same problem.

Which you only use when you need them.

(I of course indirectly use macros since the standard library is full of them. At least those are nice enough to use. But I might have gotten some weird expansions before, though?)

That will have to do until there comes along a language where you can write anything interesting as library code and still expose a nice to use interface.

pron
14h ago
> I wasn’t clear then. I would rather have N language features of increasing complexity/UX issues for dealing with increasingly complex situations rather than one mechanism to rule them all that can fail to instantiate in all cases (of whatever complexity). That’s the tradeoff that I want.

It's not that that single mechanism can fail in all situations. It's very unlikely to fail to compile in situations where the complicated language always compiles, and more likely to fail to compile when used for more complicated things, where macros may fail to compile, too.

It's probability of compilation failure is about the same as that of C++ templates. Yeah, I've seen bugs in templates, but I don't think that's anywhere near any C++'s programmer's top ten problems (and those bugs are usually when you start doing stranger things). Given that there can be runtime failures, which are far more dangerous than compilation failures and cannot be prevented, that the much less problematic compilation failures cannot always be prevented is a pretty small deal. But okay, we all prefer different tradeoffs. That's why different languages appeal to different people.

kibwen
2d ago
> Rust and C++'s biggest mistake, not passing allocators into containers and functions

Rather, basing its entire personality around this philosophy is Zig's biggest mistake. If you want to pass around allocators in C++ or Rust, you can just go ahead and do that. But the reason people don't isn't because it's impossible, it's because the overwhelming majority of the time it's a lot of ceremony for no benefit.

wolvesechoes
2d ago
2 replies
Zig community really tries to match Rust one in terms of cult resemblance.
IshKebab
2d ago
1 reply
Did it occur to you that Rust and Zig might actually be very good?
wolvesechoes
1d ago
1 reply
Oh, they are. Like a multitude of other languages.
IshKebab
1d ago
1 reply
There aren't a multitude of other languages that compete with Rust and Zig in the "zero cost abstraction" domain. There's like, Ada... and D sort of.

Rust and Zig aren't merely very good, they are better than the alternatives when you need a "zero cost abstraction" option.

But sure, go ahead and dismiss it as a cult if it makes you feel better. I bet you were one of the people who dismissed the iPhone as "just apple fanbois" back in the day. Won't amount to anything.

wolvesechoes
1d ago
But the concern in this thread wasn't that people consider Zig or Rust good, so don't try to frame it this way, because it is dishonest.

Original quote:

> [Learning Zig] is about fundamentally changing how you think about software.

This is not the same. Something like it could be said about Lisps, Forth, Prolog, Smalltalk or APL, even Brainfuck, not Rust or Zig. No, thinking about object lifetimes or allocators is not "fundamental change" in how to think about the software. It is bread and butter of thinking about software.

> I bet you were one of the people who dismissed the iPhone as "just apple fanbois" back in the day

Wrong. I still dismiss people praising Apple, swallowing some bullshit about "vision" etc. as fanboys.

hnarn
2d ago
2 replies
People that consider other people that are excited about something "culty" are usually people that themselves are excited by absolutely nothing.
wolvesechoes
1d ago
Nicely formulated, yet not less empty than the picture you try to sketch.
goku12
2d ago
That's a very profound statement! Logical and sounds intelligent. Nice one!

PS: I'm stealing it, by the way.

IshKebab
2d ago
1 reply
I guess comptime is a little different but yeah I wouldn't say it fundamentally changes how you think about software.
vlovich123
2d ago
1 reply
D has similar comptime capabilities if I recall correctly and proceeds Zig by almost 2 decades or so.
IshKebab
2d ago
1 reply
I don't think it's the same. You can do template metaprogramming, but Zig lets you use Zig itself which is a lot nicer.

I'm not a D programmer though so I could be wrong.

vlovich123
1d ago
I’m not a D programmer but I remember talks by Alexandrescu where he was arguing for this capability in C++ and ultimately one of his stated reasons why he switched from C++ to D

Look up static if - AST manipulation in native D code.

torginus
2d ago
Ugh what an LLMism
adev_
2d ago
> It is about fundamentally changing how you think about software.

> I'm not sure what they expect, but to me Zig looks very much like C

Yes. I think people should sincerely stop with this kind of wording.

That makes Zig looks like some kind of cult.

Technically speaking, Zig democratized the concept of imperative compile time meta-programming (which is an excellent thing).

For everything else, this is mainly reuse and cherry pick from other languages.

fainpul
2d ago
[delayed]
pron
2d ago
Zig is so novel that it's hard to find any language like it. Its similarity to C is superficial. AFAIK, it is the first language ever to rely on partial evaluation so extensively. Of course, partial evaluation itself is not new at all, but neither were touchscreens when the iPhone came out. The point wasn't that it had a touchscreen, but that it had almost nothing but. I have nothing against OCaml, but it is a variant of ML, a 1970s language, that many undergrads were taught at university in the nineties.

I'm not saying everyone should like Zig, but its design is revolutionary:

https://news.ycombinator.com/item?id=45852774

maxbond
2d ago
My limited understanding is that it comes into it's own when you start to take advantage of it's advanced const runtime, and that that does lead to novel types of metaprogramming. But I'm punting on learning it until 1.0 so can't speak from first hand experience.
pelasaco
2d ago
2 replies
I'm a C/C++ developer. I write production code in MQL5 (C-like) and Go, and I use Python for research and Automation. I can work with other languages as well, but I keep asking myself: why should I learn Zig?

If I want to do system or network programming, my current stack already covers those needs — and adding Rust would probably make it even more future-proof. But Zig? This is a genuine question, because the "Zig book" doesn’t give me much insight into what are the real use cases for Zig.

tamnd
2d ago
1 reply
If you're doing it for real-world values, keep doing that. But if you want traction, writing in a "fancy" language is almost a requirement. "A database engine written in Zig" or "A search engine written in Zig" sounds much flashier and guarantees attention. Look at this book: it is defintely an AI slop, but it stays at the top spot, and there's barely any discussion about the language itself.

Enough rant, now back on some reasons for why choosing Zig:

   - Cross platform tools with tiny binaries (Zig's built in cross compilation avoids the complex setup needed with C)
   - System utilities or daemons (explicit error handling instead of silent patterns common in C)
   - Embedded or bare metal work (predictable rules and fewer footguns than raw C)
   - Interfacing with existing C libraries (direct header import without manual binding code)
   - Build and deployment tooling (single build system that replaces Make and extra scripts)
For my personal usage, I'm working on replacing Docker builds for some Go projects that rely heavily on CGO by using `zig cc`. I'm not using the Zig language itself, but this could be considered one of its use cases.
pelasaco
2d ago
1 reply
> For my personal usage, I'm working on replacing Docker builds for some Go projects that rely heavily on CGO by using `zig cc`. I'm not using the Zig language itself, but this could be considered one of its use cases.

Hm, i can see a good use case when we want to have reproducible builds from go packages, including its C extensions. Is that your use case, or are you aiming for multi-environment support of your compiled "CGO extensions"

tamnd
2d ago
My use cases similar to this https://blog.afoolishmanifesto.com/posts/golang-zig-cross-co...

need to bundle a lot of C libraries, some using dynamic linking and some using static linking, and I need to deploy them on different operating systems, including some that are difficult to work with like RHEL. Right now the builds are slow because I use a separate Dockerfile for each platform and then copy the binary back to the host. With Zig CC I could build binaries for different platforms and architectures without using Docker.

oscargrouch
2d ago
1 reply
My take on this as someone that professionally coded in C, C++, Go, Rust, Python (and former darlings of the past) is that Zig gives you the sort of control that C does with enough niceties as to not break into other idioms like C++ and Rust does in terms of complexity. Rust "breaks" on some low level stuff when you need to deal with unsafe (another idiom) or when you need to rely on proc-macros to have a component system like Bevy does. Nothing wrong with this, is just that is hard to cover all the ground. The same happens with C++, having to grow to adapt to cover a lot of ground it ended up with lots of features and also with some complexity burden.

In my experience with Zig, you have the feeling of thinking more about systems engineering using the language to help you implement that without resorting to all sort of language idioms and complexity. It feels more intuitive in way giving it tries to stay simple and get out of your way. Its a more "unsurprising" programming language in terms of what you end up getting after you code into it, in terms of understanding exactly how the code will run.

In terms of ecosystem, lets say you have Java lunch, C lunch and C++ lunch (established languages) in their domains. Go is eating some Java(C#, etc..) lunch and in smaller domains some C++ lunch. Rust is in the same heavy weight category as Go, but it can eat more C++ lunch than Go ever could.

Now Zig will be able to compete in ways that it can really be an alternative to C core values, which other programming languages failed to achieve. So it will be aimed at things C and C++ are doing now and where Go and Rust wont be good candidates.

If you used Rust long enough you can see that while it can cover almost all ground its not a good fit for lower level stuff or at least not without some compromises either in performance or complexity (affecting productivity). So its more in the same family as C++ in terms of what you pay for (again nothing wrong with that, is just that some complex codebases will need a good amount of man-hours effort in the same line as C++ does).

With Zig you fell more focused on the machine with less abstractions as in C but with enough goodies that can make even the most die-hard C developer think about using it (something C++ and Rust never managed to do it).

So i think Zig will have its place in the sun as Rust does. But I see Rust taking more the place where Java used to be (together with Go) + some things that were made in C++ where Zig will be more focused on system and low level stuff.

Modern C++ will still be around, but Rust and Zig will used more and more where languages like C and C++ used to be the only real contenders

pelasaco
1d ago
thank you for your detailed answer. I found another great discussion around Zig here https://news.ycombinator.com/item?id=26374647
atwrk
2d ago
1 reply
> Learning Zig is not just about adding a language to your resume. It is about fundamentally changing how you think about software.

Written by ChatGPT?

wkjagt
2d ago
> You came for syntax. You'll leave with a philosophy.
virajk_31
2d ago
3 replies
Folks! do I really need learn Zig? I am already good with Rust!!
epolanski
2d ago
1 reply
Bar C if you're into system's programming there's no language you *need* to learn.
virajk_31
2d ago
1 reply
Partially agree on this, std lib/crates and ease of use do make a difference, though Rust certainly has its own headaches. (Imagine searching for someone's implementation of HashedMap on github or using dedicated packages like glib, when you get it easily at crates.io). Again this is subjective based on use cases.
epolanski
1d ago
Not much for authoring new code as much as reading it, it's the lingua franca.
tamnd
2d ago
2 replies
Yeah, you should. Zig is a trending language right now, and in the coming years many projects are likely to be rewritten in Zig instead of Rust (often referred to as "riiz").
virajk_31
2d ago
1 reply
Is this sarcasm? if yes I got your joke otherwise please enlighten me _/\_
tamnd
2d ago
I was half joking. Folks keep saying everything will get rewritten in Zig, so I played along with that. Nothing serious behind it.

With only half serious intent, I think only the real wizard types, like Jarred Sumner (Bun) and Mitchell Hashimoto (Ghostty), who understand both low level systems and higher level languages, should be writing big tools in Zig. The tough part in the next few years will not be building things, it will be keeping them alive if the authors step away or the ecosystems move in a different direction.

WA
2d ago
1 reply
So, a new JS linter written in Zig, when?
virajk_31
2d ago
is it even required?
benrutter
2d ago
[delayed]
rudedogg
2d ago
2 replies
I submitted this and unfortunately it is likely AI generated. The authors github history suggests it at the very least, along with seemingly misunderstanding a reference to a Zig language feature (labeled blocks - https://zig.guide/language-basics/labelled-blocks/) in the project issues (https://github.com/zigbook/zigbook/issues/4).

I’m not sure how much value is to be had here, and it’s unfortunate the author wasn’t honest about how it was created.

I wish I wouldn’t have submitted this so quickly but I was excited about the new resource and the chapters I dug into looked good and accurate. I worry about whether this will be maintained, and if it’s worth investing time into.

Wowfunhappy
2d ago
2 replies
Are you sure? Right on https://www.zigbook.net/chapters/00__zigbook_introduction it says:

> The Zigbook intentionally contains no AI-generated content—it is hand-written, carefully curated, and continuously updated to reflect the latest language features and best practices.

The author could of course be lying. But why would you use AI and then very explicitly call out that you’re not using AI?

UpsideDownRide
2d ago
Because AI content is at minimum controversial nowadays. And if you are ok with lying about authorship then It is not further down the pole to embelish the lie a bit more
rudedogg
2d ago
> Are you sure?

There are too many things off about the origin and author to not be suspicious of it. I’m not sure what the motivation was, but it seems likely. I do think they used the Zig source code heavily, and put together a pipeline of some sort feeding relevant context into the LLM, or maybe just codex or w/e instructed to read in the source.

It seems like it had to take quite a bit of effort to make, and is interesting on its own. And I would trust it more if I knew how it was made (LLMs or not). Things seem accurate, I think due to them doing a good job supplying the correct context to the model.

As another suspicious data point see this issue by the author: https://github.com/microsoft/vscode/issues/272725

cryptocod3
2d ago
2 replies
> if there are hallucinations

Plenty. I assumed that the code examples had been cleaned up manually, so instead I looked at a few random "Caveats, alternatives, edge cases" sections. These contain errors typically made by LLMs, such as making up stuff that don't exist (std.mem.terminated), are non-public (argvToScriptCommandLineWindows) or removed (std.BoundedArray). These sections also surfaces irrelevant stdlib implementation details.

PaulRobinson
2d ago
2 replies
This looks like more data towards the "LLMs were involved" side of the argument, but as my other comment pointed out, that might not be an issue.

We're used to errata and fixing up stuff produced by humans, so if we can fix this resource, it might actually be valuable and more useful than anything that existed before it. Maybe.

One of my things with AI is that if we assume it is there to replace humans, we are always going to find it disappointing. If we use it as a tool to augment, we might find it very useful.

A colleague used to describe it (long before GenAI, when we were talking about technology automation more generally) as following: "we're not trying to build a super intelligent killer robot to replace Deidre in accounts. Deidre knows things. We just want to give her better tools".

So, it seems like this needs some editing, but it still has value if we want it to have value. I'd rather this was fixed than thrown away (I'm biased, I want to learn systems programming in zig and want a good resource to do so), and yes the author should have been more upfront about it, and asked for reviewers, but we have it now. What to do?

necklesspen
2d ago
There's a difference between the author being more upfront about it and straight-up lying on multiple locations that zero AI is involved. It's stated on the landing page, documentation and GitHub - and there might be more locations I havent' seen.

Personally, I would want no involvement in a project where the maintainer is this manipulative and I would find it a tragedy if any people contributed to their project.

spacechild1
2d ago
> and yes the author should have been more upfront about it

They should not have lied about. That's not someone I would want to trust and support. There's probably a good reason why they decided to stay anonymous.

dtj1123
2d ago
Just found a good example in chapter 30, main lines 89-95: ``` const approx = text.len / shards; // approximate bytes per shard ...

    var i: usize = 0;
    while (i < text.len) {
        var end = @min(text.len, i + approx);
```

approx is equal to text.len divided by the number of shards plus 0, which is strictly less than or equal to text.len. Taking the minimum of the two is obviously redundant.

vad1d3v
2d ago
I don't know any of you. But Zig has opened way big door for system programming for people like me who has never done that before. And, Zig code looks (for a guy comes from curly braces language) easier to understand with really small learning curve.
pkphilip
2d ago
Very well done! wow! Thanks for this. Going through this now.
bargainbin
2d ago
> No hidden control flow: Zig has no hidden allocators, goroutines…

Neither of those things are control flow, and yet again I’m reading a pro-Zig text taking a dig at Go without any substance to the criticism.

Also funny having a dig at goroutines when Zig is all over the place with its async implementation.

xaxaxb
2d ago
Shiny
delifue
2d ago
A nitpick about website: the top progress bar is kind of distracting (high-constrast color with animation). It's also unnecessary because there is already scrollbar on the right side.
timeon
2d ago
Using Next.js and Tailwind-bloat feels anti-Zig, yet it is there.
finalhacker
2d ago
wow, it's so cool.
rrgok
2d ago
I guess now the trend is Zig. The era of Javascript framework has come to end. After that was AI tend. And now we have Zig and its allocators, especially the arena allocator.

/S

smakt
2d ago
Haha the fucking garbage. Before AI, before the internet, this overexaggerated, hokey prose was written by scummy humans and it came exclusively in porn magazines along with the x-ray specs and sea-monkey fishtanks.
samgranieri
2d ago
As someone who is diving deep into Zig, I’m actually going to evaluate all this (and compare this to Ziglings) or the Zig track on Exercism.
CraftingLinks
2d ago
The gratuit accusations in this thread should be flagged.

224 more comments available on Hacker News

ID: 45947810Type: storyLast synced: 11/19/2025, 12:18:03 PM

Want the full context?

Jump to the original sources

Read the primary article or dive into the live Hacker News thread when you're ready.