Live data from Hacker News

Zig by Example

github.com

41–50 of 109 posts

Re: Zig by Example

#41

Earlier quoted context omitted.

IMO, there isn't much space left to fill that Rust couldn't already fill.

Simplicity is one thing Zig excels at (at least from my early observations).

How crazy is it to have a language where combining two foundation traits is such a huge footgun that the linter has to warn you (but somehow you can't ban it within the language)

Re: Zig by Example

#42
post #21

Is Zig just a trend, or will it become a solidly established language? After all, learning something is an investment of time. With Zig, it doesn't seem to have the same kind of industry pressure as Rust. There's talk in open source circles about AI-related issues, and on Hacker News people say good things about Zig. The allocator concept looks great. But there's also a possibility that it won't become mainstream, li…

If you want to learn systems programming, I can recommend learning C. If you want to learn a programming language which allows systems programming, I guess Rust is not a bad choice. But it might be less helpful if the systems basics are unknown.

I'm an industrial equipment programmer, so I do see C quite often. Actually, aside from C, it's just that when I first learned programming in college, I started with C. I thought that was only natural, but I guess I didn't explain enough. Inside my own head, C just feels like a given.

Re: Zig by Example

#43

Earlier quoted context omitted.

IMO, there isn't much space left to fill that Rust couldn't already fill.

Simplicity is one thing Zig excels at (at least from my early observations).

Haven't yet used Zig in anger, but it looks more like a successor to C (with a bit of Go), whereas Rust is a successor to C++, first and foremost.

Re: Zig by Example

#44

I just looked this up yesterday so sharing some more up-to-date resources for those interested in Zig: - Learning Zig by Karl Seguin: https://www.openmymind.net/learning_zig/ - https://zig.guide/ - Free project-based online book Introduction to Zig by Pedro Park: https://pedropark99.github.io/zig-book . - Ziglings, almost working programs you need to fix: https://codeberg.org/ziglings/exercises

"More up-to-date" meaning more sources that are also up to date like the OP, or meaning that the OP is not up to date? Silly English language!

Re: Zig by Example

#46

Encapsulating arguments inside .{} seems superfluous and noisy. I'm sure this can be rationalized in some way, to either simplify parsing or solve some rare ambiguity, but I just don't see it. I know this is a minor thing and can be considered as nitpicky, and I expect some friction with syntax when learning a new language, but I just can't stand things I see as gratuitous. Same with the forced use of _ = foo(.{}); t…

In Zig, function arguments are not wrapped in `.{}`. `.{}` is the syntax for creating a struct or a tuple. This is used as a pattern for allowing optional arguments (options struct) and variadic functions (tuple).

Explicitly discarding return values is a thing many modern programming languages force you to do.

Re: Zig by Example

#47
post #21

Is Zig just a trend, or will it become a solidly established language? After all, learning something is an investment of time. With Zig, it doesn't seem to have the same kind of industry pressure as Rust. There's talk in open source circles about AI-related issues, and on Hacker News people say good things about Zig. The allocator concept looks great. But there's also a possibility that it won't become mainstream, li…

Lindy effect is very strong in the programming languages world.

Zig is a very interesting and well built language, but it is also niche, unstable and not offering radical improvements over C.

C, as the foundation of all modern kernels and system tools, among many other things, is extremely unlikely to go away soon.

Everything you do in Zig can be done almost in the same way in C or C++.

I would say the real value of Zig is in the standard library that is more modern and arguably better.

Re: Zig by Example

#48

I'm missing the concurrency model.

For what it's worth, the concurrency model is very similar to the one in Go. Zig has std.Io.Queue instead of channels, std.Io.async and std.Io.concurrent instead of the go keyword, and switch over std.Io.Select instead of the select keyword. There are lots of resources on concurrency in Go, and the learning semantics would carry nicely over to Zig.

Re: Zig by Example

#49
post #21

Is Zig just a trend, or will it become a solidly established language? After all, learning something is an investment of time. With Zig, it doesn't seem to have the same kind of industry pressure as Rust. There's talk in open source circles about AI-related issues, and on Hacker News people say good things about Zig. The allocator concept looks great. But there's also a possibility that it won't become mainstream, li…

Is there a particular domain you'd like to get into? It sounds like you're wanting to build expertise in something other than CRUD app assembly, but my language recommendations might change based on whether that's embedded, game development, distributed systems, system administration, etc.

I don't think in your shoes I'd prioritize learning Zig for any of these domains, though, for a few reasons:

* It's not a pre-req for understanding some existing corpus of important software (which is a big reason for C and C++ in 2026) or the language of choice for some current hot domain (as Python is for AI).

* It's not memory-safe, which (whether via GC or Rust's borrow checker) is increasingly viewed as a critical security attribute.

* It's not stable yet, so I'd expect a certain amount of running to keep in place both in your learning and in avoiding bitrot in anything you write in it.

* From the outside, the community seems strangely hostile as well as elitist.

A few I might suggest instead: Rust (both as a language I personally like and as the most different from the ones you've already touched), Go (which is a good choice for employability), SQL (maybe you already know this one if you're doing CRUD stuff but you didn't list it), bash, and more Python and/or TypeScript.

Re: Zig by Example

#50
This is outdated and AI generated.

If you want a good source of zig learning material interactive and by examples please check out ziglings: https://codeberg.org/ziglings

It's writen and tested by humans, which is essential for learning purposes. It's listed in the official zig website, by the way.

This project is always up to date to the latest zig release.

Post reply on HN