Zig monthly, February 2022
Language interoperability keeps getting better
Haskell ↔ Zig
Calling Zig from Haskell by @luctielen covers how to leverage Zig from Haskell.
NodeJS ↔ Zig
@ziglang/cli
is a new NPM package by @pluvial which makes it easy to integrate Zig into a NodeJS project.
They’re also using it in conjunction with their other project, vite-plugin-zig to do things like WebAssembly math addition. Pretty cool!
Rust ↔ Zig
cargo-zigbuild has just been released by @messense, allowing one to compile a Rust Cargo project with Zig as linker for easier cross compilation!
mruby ↔ Zig
mruby-zig by @dantecatalfamo lets you leverage the embeddable Ruby implementation fully from Zig applications!
Huffman coding visualization
190n created a visualization of the Huffman coding algorithm
Using Zig comptime for conceptual dryness (Forth)
@lucabol shared an interesting article on Using Zig comptime for conceptual dryness - describing an implementation of the Forth language in Zig.
Telegram ↔ Zig
@axgdev wrote a telegram echo bot in Zig, pretty cool and shows usage of the requestz
HTTP library. They also streamed development of it on Twitch and more recently even released a Telegram library for Zig.
Gameboy Advance Emulator
Rekai has been working on ZBA, a gameboy advance emulator:
I’ve been working on a Gameboy Advance Emulator! With an initial (quite broken) implementation of Mode 0 Graphics I finally have something visual to show off. It’s still very early so the CPU is the only thing that really passes the gauntlet of test ROMs out there.
Simple Linking Format
@MasterQ32 released a small project for learn the basics of linking, SLF, “a very simple object file format that can be used to link programs that don’t require distinct sections for code and data.”
In-depth articles about the stage2 Zig compiler internals
Mitchell Hashimoto has been publishing a series of in-depth articles about the internals of the stage2 Zig compiler, including:
Also relevant, I highly suggest checking out Govind’s 2-part series “So where is my stuff stored ?" which dives into some of the lower-level details when investigating how Zig creates structs on the stack.
Brucelib
Although early stages and very much a work-in-progress, @hazeycode announced they are working on Brucelib:
A monorepo of modules for programming cross-platform games, simulations, engines and editors. Leveraging the Zig programming language and toolchain, brucelib intends to be highly hackable and suitable for rapid prototyping, jams or fully-fledged products. Each module is designed to be easy to configure, extend or modify to your own specific needs, and to replace with something else in future if your project demands it.
Cosmic
Cosmic is a general purpose runtime for Javascript and WASM. It aims to have broad applications by exposing native cross platform APIs: window management, 2D/3D graphics, UI widgets, filesystem, networking, and more. It also aims to streamline software tooling to provide the essentials to help you develop and maintain software.
regz: Zig code generator for microcontrollers
@mattnite and the Zig embedded group published regz, a Zig code generator for microcontrollers produced from SVD files.
Zig kills it in the WASM4 game jam
Zig games were quite prominant in the WASM4 game jam, there’s a great overview video on the new Zig forum
@freiguy1 for example did a Zig implementation of the original Snake game which you can play here: https://freiguy1.itch.io/znake
Package indexes
Now seems like a good time to re-highlight Aquila by @nektro:
A federated package index and CI system for the Zig programming language built around the Zigmod package manager.
Aquila recently got support for statistics and README rendering.
As well you should check out zig.pm, the Zig package aggregator by @MasterQ32 which you can read about here.
s2s: struct to stream | stream to struct
@MasterQ32 released an excellent binary serialization library, ziglibs/s2s:
- Convert (nearly) any Zig runtime datatype to binary data and back.
- Computes a stream signature that prevents deserialization of invalid data.
- No support for graph like structures. Everything is considered to be tree data.
Mustache logic-less template rendering
@batiati is implementing logic-less Mustache template rendering so your Zig code can render template strings like Hello {{name}} from Zig
.
2-day meetup in Milan, Italy. Apr 9-10
The first ever European Zig meetup is happening Apr 9-10 in Milan, Italy! If you’d like to attend, there’s plenty of room - you can find more information here
Thanks for reading!
If you like my work on zigmonthly, Mach engine, etc. consider sponsoring me on GitHub so I can do even more of it!