Zig
Ziglings is nice for learning.
Notes
- Zig compiler pipeline is: tokenize -> parse -> astgen -> sema -> codegen
- Automatic error unions, required error handling, errdefer, and the try keyword really give Zig my favorite error handling feel of any language.
- Types are values in zig, this means that to create generic functions you pass the type as an argument and change the function logic based on that. This is also possible thanks to another feature, running code at compile time with comptime.
- Zig has good "surface area minimalism". comptime is just one keyword, but it replaces the entire C preprocessor (well, mostly), a template/generics system, type reflection, and probably a few more things. Same with the build system: I don't need to learn a separate language to describe builds, instead the build system is (mostly) just a stdlib module. It's true that the Zig's error handling, tagged unions, slices, etc... are "less minimalistic" than C, but those things exist to fix obvious problems of C in a way that would be hard to do in libraries, and because of this they are justified.
- Most significant optimization that zig enables is stack backed allocators. Allocators being passed around in function calls, a third party library that allocates stuff doesn't have to know where the data is allocated. It's up to the client code to chose what allocator they provide, effectively allowing stack-only allocations, even in third-party code.
Links
- Zig Learn (Code)
- The Road to Zig 1.0 - Andrew Kelley (2019)
- Pluto - Hobby x86 kernel written in Zig.
- Hobby x86 kernel written with Zig (HN)
- Zig Compiler Internals (2020)
- bootstrap-zig - Start with minimum system dependencies and end with a fully operational Zig compiler for any target.
- Zig 0.6.0 Release Notes (HN)
- PBUI Project - Standard library toolsets in the Zig programming language. (Code)
- A Brief Exploration of Zig (2020)
- zls - Zig LSP implementation + Zig Language Server.
- zls: A Zig Language Server - Alex Naskos & Auguste Rame (2020)
- Why Zig When There is Already CPP, D, and Rust? (Lobsters)
- Zig: a great fit for emulators - Benjamin Feng (2020) (Lobsters)
- What is Zig's “Colorblind” Async/Await? (2020) (Lobsters)
- Zig Showtime - Show where members of the Zig community share code and ideas.
- Announcing the Zig Software Foundation (2020) (HN)
- Zig Live Coding: Self-Hosted Incremental Compilation Debug Info + LLVM 11 Upgrade (2020)
- Awesome Zig
- Awesome Zig 2
- Zig Learning & Usage Guide
- Interview with Zig language creator Andrew Kelley (2020) (HN)
- What is Zig's Comptime? (2019)
- Zig's New Relationship with LLVM (2020) (HN) (Lobsters)
- Zig Compiler September Update & Hot Code Swapping Brainstorming (2020)
- Advanced Hello World in Zig - Loris Cro (2020)
- Zig heading toward a self-hosting compiler (2020)
- Assorted thoughts on zig (and rust) (2020) (Lobsters) (HN)
- Is Zig the Long Awaited C Replacement? (2020) (Lobsters)
- zigup - Download and manage zig compilers.
- Zig Spec
- Pirates of Apple Silicon - Jakub Konka, Frank Denis, Andrew Kelley (2020)
- Zig in 30 Minutes (HN)
- Extending C with Zig
- Why Zig when there is already C++, D, and Rust? (HN)
- Zig Makes Go Cross Compilation Just Work (2021) (Lobsters)
- Ziglings - Learn the Zig programming language by fixing tiny broken programs. (HN) (Stream doing Ziglings)
- Zig Docs
- Zig Roadmap 2021 (Lobsters)
- Why I rewrote my Rust keyboard firmware in Zig: consistency, mastery, and fun (2021) (Lobsters)
- Memory-mapped IO registers in zig (2021) (Lobsters)
- Zig, Parser Combinators - and Why They're Awesome (2021)
- How Safe Is Zig? (Lobsters) (HN) (HN)
- Zig Playground - Online Zig compiler inspired by Go and Rust. (Code)
- zigdoc - zig -> docs.
- zig.run - Run and play with Zig source code. (Code)
- An intro to Zig's integer casting for C programmers (HN)
- Performance Tracking for Zig
- Building an efficient and portable programming language with Zig (2021) (Lobsters)
- Zig Makes Rust Cross-compilation Just Work (2021) (HN) (Lobsters)
- setup-zig - Use the Zig compiler in your Github Actions workflows.
- Corecursive: Andrew Kelly Built Zig (2021) (Reddit) (HN)
- Zig wrinkles (2021) (Lobsters)
- Zig pathtracer (2021) (HN)
- Async engines in C++20, Rust, & Zig (2021)
- Android Apps in Zig - Contains a example on how to create a minimal Android app in Zig.
- Looking into Odin and Zig (2021) (HN)
- Maintain It with Zig (2021) (HN) (Lobsters)
- ziglint - Linting suite for Zig.
- Resource efficient Thread Pools with Zig (2021) (HN)
- Zig News
- Code Coverage for Zig with Callgrind (2021)
- Fuzzing Zig Code Using AFL++ (2021) (HN)
- Building gamedev ecosystem for Zig
- Asserting function signatures at compile time in Zig (2021)
- Mach Engine: The Future of Graphics (With Zig) (2021) (HN) (Code)
- Andrew Kelley, Lead Developer & President of the Zig Software Foundation (2021)
- zig-snapshots - Preview Zig's incremental linker state in interactive HTML.
- Zig LSP - LSP implemented in Zig.
- Perfecting GLFW for Zig, and finding lurking undefined behavior that went unnot (2021) (HN)
- Zig monthly - Once-a-month publication where I curate all things Zig.
- zig build explained (2021)
- A Practical Guide to Applying Data-Oriented Design - Andrew Kelley (2021) (Lobsters)
- The ZLD Linker (2021)
- Interfacing with Zig, a BDFL-run project (2021)
- Nix flake for Zig
- Zig Compiler Internals
- Allocgate: Restructuring how allocators work in Zig (2021) (HN)
- List of Zig Gamedev Projects
- Minimal build.zig for targeting iOS
- Zig 0.9.0 (HN)
- What do you think about Zig? (2021)
- A Review of the Zig Programming Language (Using Advent of Code 2021) (HN)
- A Comparison of Rust and Zig (HN)
- Analysis of the overhead of a minimal Zig program (2022) (Lobsters)
- Zig Strings in 5 minutes (Lobsters)
- Failing to Learn Zig via Advent of Code (2022) (HN) (Lobsters)
- Let's build an Entity Component System from scratch in Zig (2022)
- Using Zig to Build Native Lua Scripts (2022)
- Zig by Example (Code)
- Zig Compiler Internals (HN)
- Is Zig faster than Rust?
- Why use Zig over Rust/Go (2022)
- ziglibc - Exploration on creating a libc implementation in Zig.
- Using Zig as cross-platform C toolchain (2022) (HN)
- ZigSelf: An implementation of Self in Zig (Lobsters)
- zigtool - Go tool of the zig compiler automatically compiles different targets according to the GOOS GOARCH environment variable.
- Hot-code reloading on macOS/arm64 with Zig (2022) (HN)
- wazm - Web Assembly Zig Machine.
- Looking at Zig Programming Language (2022) (HN)
- I Believe Zig Has Function Colors (2022) (Lobsters) (HN)
- Zig Bit Twiddling Hacks
- Zig self-hosted compiler can now build itself (2022) (HN) (Lobsters)
- Zig interpreter written in TypeScript
- Zig Web Code
- Getting Started with Zig on the Raspberry Pi Pico
- Minimal example showing how HTML5's canvas, WASM memory and Zig can interact
- Uber Uses Zig (2022) (HN) (Lobsters)
- Zig PyPI distribution - Zig programming language, packaged for PyPI. Lets you run Zig code from Python easily. (Tweet)
- Mixins in Zig (HN)
- Learn Zig by examples (Code)
- Paid Zig Stream (2022)
- Testing Zig for embedded development (2022)
- An Intro to Zig's checkAllAllocationFailures (2022)
- Zig Common Tasks - Collection of Zig code snippets for some of the most common tasks.
- How to get started with Zig? (2022)
- Zig is becoming more production-worthy (2022)
- Zig Language Server (zls) for VSCode
- Some Thoughts on Zig (2022) (HN)
- Makin' wavs with Zig (2022) (Lobsters)
- Running Zig with WASI on Cloudflare Workers (2022) (HN)