Hacker News with Generative AI: Zig

Deus Lex Machina: releasing a new compacting Zig tokenizer (validark.dev)
Today, I am excited to announce the alpha release of a brand new compacting Zig tokenizer!
Things Zig comptime won't do (matklad.github.io)
Zig’s comptime feature is most famous for what it can do: generics!, conditional compilation!, subtyping!, serialization!, ORM! That’s fascinating, but, to be fair, there’s a bunch of languages with quite powerful compile time evaluation capabilities that can do equivalent things. What I find more interesting is that Zig comptime is actually quite restrictive, by design, and won’t do many things! It manages to be very expressive despite being pretty limited. Let’s see!
Things Zig Comptime Won't Do (matklad.github.io)
Zig’s comptime feature is most famous for what it can do: generics!, conditional compilation!, subtyping!, serialization!, ORM! That’s fascinating, but, to be fair, there’s a bunch of languages with quite powerful compile time evaluation capabilities that can do equivalent things. What I find more interesting is that Zig comptime is actually quite restrictive, by design, and won’t do many things! It manages to be very expressive despite being pretty limited. Let’s see!
Zig and GPUs (alichraghi.github.io)
GPU programming used to mean wrangling C++ compilers, bloated SDKs, and vendor-specific toolchains. That’s changing. You can now write GPU code in modern languages like Rust and Zig with fewer layers. This post walks through the current state of Zig’s GPU backends and how they stack up across Vulkan, OpenCL, and native ISAs.
Zack: A Simple Backtesting Engine in Zig (github.com/zerotech-studio)
Welcome to Zack! This project is a lightweight yet powerful backtesting engine for trading strategies, written entirely in Zig ⚡. It allows you to test your trading ideas against historical market data to see how they might have performed.
A high-throughput parser for the Zig programming language (github.com/Validark)
A high-throughput tokenizer and parser (soon™️) for the Zig programming language.
Zig's new LinkedList API (it's time to learn fieldParentPtr) (openmymind.net)
In a recent, post-Zig 0.14 commit, Zig's SinglyLinkedList and DoublyLinkedList saw significant changes.
Show HN: Zig Topological Sort Library for Parallel Processing (github.com/williamw520)
TopoSort is a highly efficient Zig library for performing topological sort on dependency graph.
Building Statically Linked Go Executables with CGO and Zig (calabro.io)
This is a short post about how to create a statically linked Go executable that calls in to CGO dependencies using Zig.
Dead Simple Snapshot Testing in Zig (kristoff.it)
I’ve recently added snapshot testing support to Zine, my static site generator, and I’ll share here how to get a similar setup going for your projects.
Crabtime: Zig’s Comptime in Rust (crates.io)
Zig's dot star syntax (value.*) (openmymind.net)
Maybe I'm the only one, but it always takes my little brain a split second to understand what's happening whenever I see, or have to write, something like value.* = .{...}.
Zig 0.14.0 Release Notes (ziglang.org)
Zig 0.14.0 implements an accepted proposal which allows switch statements to be labeled, and to be targeted by continue statements.
No-Libc Zig Now Outperforms Glibc Zig (ziglang.org)
No-Libc Zig Now Outperforms Glibc Zig
No-Libc Zig Now Outperforms Glibc Zig (ziglang.org)
No-Libc Zig Now Outperforms Glibc Zig
Sets and Bitsets, from Python to Zig (eno-writer.com)
It's been over a year since I switched from programming in high level languages (python and javascript) to programming in a low level language (zig). Supposedly, high level languages are much easier to work with than low level languages, but I've been surprised by how infrequently I've felt myself longing for the expressiveness of python. In fact, last week was the first time I actually found myself having to switch to python to figure something out.
Zig; what I think after months of using it (strongly-typed-thoughts.net)
Ah, Zig. I have a love-hate relationship with this one. A “new” (reading: appeared a couple years ago, already — yes, already), language with high ambitions. Zig was made to run at low-level, with a simple design to solve many problems C has (macros, allocators, error handling, more powerful types like baked-in tagged unions and bitsets, a better build system, no hidden control flow, etc.).
Roc rewrites the compiler in Zig (github.com)
Roc's compiler has always been written in Rust, and we do not plan to self-host.
In Zig, what's a writer? (openmymind.net)
I find Zig's idea of a "writer" confusing. This is probably because there are three different types, each trying to compensate for compromises made by the others. Let's try to understand what each is and how it fits into a bigger whole.
Show HN: Lightpanda, an open-source headless browser in Zig (github.com/lightpanda-io)
Lightpanda is the open-source browser made for headless usage:
Zig: What to Expect from Release Month (ziglang.org)
Zig's comptime is bonkers good (scottredig.com)
Programming has obvious abilities to increase productivity through automated manipulation of data. Metaprogramming allows code to be treated as data, turning programming’s power back onto itself. Programming close to the metal has perhaps the most to gain from metaprogramming as high level concepts need to be mapped precisely to low level operations. Yet outside of functional languages I’ve always found the metaprogramming story to be a disappointment.
I wrote a Game Boy Advance game in Zig (jonot.me)
The Game Boy Advance is an interesting game console. It has a modern-style CPU (32-bit ARM, lots of registers), but uses an old-fashioned tile based renderer like how the NES did it in the 80s.
When Zig Is Safer and Faster Than Rust (zackoverflow.dev)
There are endless debates online about Rust vs. Zig, this post explores a side of the argument I don't think is mentioned enough.
Show HN: My terminal learned a new trick (Colors in Zig) (github.com/NishantJoshi00)
Color Show is a Zig utility that renders solid-color rectangles directly in the terminal using the Kitty graphics protocol. Simply pass hexadecimal color codes as command-line arguments to display vibrant color blocks.
Why am I writing a JavaScript toolchain in Zig? (injuly.in)
Few things keep me up at night more than the untapped potential in current developer tooling.
Zig Reproduced Without Binaries (jakstys.lt)
I decided to bootstrap Zig without using binaries that are checked in the repository and answer if the resulting zig1.wasm in the latest Zig release (0.13.0) is the same the one bootstrapped without using those binaries.
The Unreasonable Effectiveness of Naming Integers (ziglang.org)
Lately my Zig code has started to look like this in all my projects:
Zig's (.{}){} Syntax (openmymind.net)
One of the first pieces of Zig code that you're likely to see, and write, is this beginner-unfriendly line:
Zigler: Zig NIFs in Elixir (github.com/E-xyza)
Zigler is available in Hex, and the package can be installed by adding zigler to your list of dependencies in mix.exs: