Zig patterns

After Mitchell’s Ghostty talk decided to write down the basic Zig patterns that I’d either noticed in the standard library or seen on the Zig News forum. Thought it’d be nice to have a dedicated post for them here. Feel free to brainstorm any additions or suggest other names for these.

Here we go:


I’ve only looked at a few of these so far but this is awesome! My only concern is that blog posts and the like have a tendency to bit rot as the language (or standard library) evolves. If these were ultimately integrated into the standard library as “testable documentation” they could evolve along with the language and standard library.