What does HackerNews think of ziglings?

Learn the Zig programming language by fixing tiny broken programs.

Language: Zig

+1 for rustlings, which also inspired "ziglings" [1]. Both of these were great resources for quickly & easily learning the basics of their respective languages.

[1] https://github.com/ratfactor/ziglings

I really like the ziglings collection for an introduction (mainly for beginners but still lots of fun)

https://github.com/ratfactor/ziglings

It's unfortunately the only comprehensive reference I know of besides the official docs.

There is "Ziglings", but those are a collection of small exercises with answers rather than a full guide.

https://github.com/ratfactor/ziglings

If you know of better resources than these two, please do share (not being passive aggressive here).

Ziglings [0] is a series of small problems where you solve bugs in Zig code, and I enjoyed working through them. The readme claims "you are not expected to have any prior experience with... C." When I did ziglings I found the most difficult part was adjusting to the type syntax (which I now love).

I admittedly know C very well, but assuming you already know a language with a C-like syntax (C++, Java, JavaScript, C#, Rust, etc.) most things like functions, control flow, variables, statements map to Zig with only small syntactic differences.

One thing that may be difficult to learn not knowing C is working with strings, since they are just arrays of bytes. Most other languages have a string type, but Zig is much more like C in that strings are null-terminated fixed-sized arrays of bytes.

[0] https://github.com/ratfactor/ziglings

Start with Ziglings: https://github.com/ratfactor/ziglings and then after working through all the exercises read chapter 2 of ziglearn.org.
:) I am currently working through https://github.com/ratfactor/ziglings for Zig.
Some context on the issues you pointed (all true, to be clear):

> * no (official) package manager yet, though this is aparently being worked on

It's the next item on the roadmap as soon as the self-hosted compiler is good enough.

> * documentation is often incomplete and lacking

The language reference is good, but for the stdlib it's best to just read the source code. For other miscellaneous learning materials:

https://ziglearn.org/

https://github.com/ratfactor/ziglings

https://www.youtube.com/c/ZigSHOWTIME

> * error handling with inferred error sets and `try` is very nice! But for now errors can't hold any data, they are just identifiers, which is often insufficient for good error reporting or handling.

It's still under debate and I'm personally in the camp that errors should not have a payload, so I would avoid assuming that it's definitely the preferable choice. We already have a couple of existing patterns for when diagnostics are needed. That said proposals about adding support for error payloads are still open, so who knows.

https://github.com/ziglang/zig/issues/2647

https://github.com/ziglang/zig/issues/7812

Existing pattern: https://github.com/ziglang/zig/issues/2647#issuecomment-5898...

> * No closures! (big gotcha)

It's possible to create closures already (by declaring a struct type with a method (the closure) and instantiating it immediately after), but it's a clunky solution. We also have an open proposal in this space:

https://github.com/ziglang/zig/issues/6965