Intro to the Zig Programming Language • Andrew Kelley • GOTO 2022

I continue to like what I’m seeing in Zig …

Notes:

  • A general-purpose programming language and toolchain for maintaining robust, optimal, and reusable software.
  • increase the utility of the commons
    • referenced a quote from the author of the mold linker
  • re-examine the fundamental building blocks of software
    • example:memory allocation – we pass allocators around
    • example: dependency on libc
  • raise the standards of software as a craft
    • tooling such as zig cc
    • robust, high-performance open source libraries
      • not only Zig but all languates via the C ABI
    • provide guidance to students in ethics and skills
  • Moto: Maintain It With Zig
    • Level 1: drop in zig cc
      • How Zig is used at Uber
      • good defaults
      • undefined behavior by default
      • cross-compilation
        • zig cc -o hello hello.c -target x86_64-windows
        • zig cc -o hello hello.c -target aarch64-macos
        • zig c++ o hello.cpp
        • zig cc -o hello hello.c -target aarch64-linux-gnu.2.31
        • zic cc -o hello hello.c -target aarch64-linux-musl (statically linked, works on any distro)
        • built-in caching
        • trivial installation
    • Level 2: zig build
      • build.zig file
      • coming soon – package manager, fulfilling C/C++ dependencies
    • Level 3: Write a component in Zig
      • easy to mix C and Zig code
      • LTO (optimizer)
  • How to predict the future
    • Non-Profits vs VC-backed Startups vs Private companies
  • Zig Software Foundation
    • we have achieved financial stability
    • we have released a useful working product
    • happy, talented, self-directed staff
    • ambitious roadmap
    • secure future
    • board or directors is the boss – when Andrew is gone, it will continue to operate
  • Zig in Action
    • Zig is general-purpose, which means it gives you the tools to generate the best possible machine code for the target, whether it is hardware or a virtual machine.
    • This makes it applicable to anything resembling a Vonn Neumann machine
    • But there are some cases where Zig truly excels thanks to its conservative language design choices.
    • Rive Window Manager
    • Bun – javascript runtime
      • Why is Bun fast? An enormous amount of time spent profiling, benchmarking and optimizing things. The answer is different for every part of Bun, but one general theme: Zig’s low-level control over memory and lack of hidden control flow makes it much simpler to write fast software. Sponsor the Zig Software Foundation.
    • Zigler - Elixer – use Zig in Elixer
    • VFX Plugins
    • Digital Audio Workstation
    • Mach game engine and graphics toolkit
    • Zig-Gamedev
    • TigerBeetle
    • Unmanned store in Sillerud
      • reports there were zero bugs
    • Zig Embedded Group
      • MicroZig – hardware abstraction layer
    • BoksOS
    • WASM-4 Games
  • Taste of Zig
    • ArrayList
    • a few orthogonal concepts that work together
    • users don’t spend much time fighting the language
    • Inline Loops
    • InlineLoops
    • AutoArrayHashMap
    • Zig uses generics, meta programming, and reflection a lot
    • unit tests automatically detect memory leaks
    • MultiArrayList
    • C Integration
      • example of cross compiling
      • builds all dependencies like SDL
  • Summary
    • Zig Software Foundation is a non-profit organization dedicated to improving the craft of software engineering as a whole.
    • Zig is a C/C++ compiler toolchain and build system that can be used to simplify maintenance of your existing projects.
    • Zig is a simple, powerful programming language that excels in the most demanding environments.