
← BEAM There, Done That17 jul · 1 u 03 min
Zig Meets the BEAM: Garrison Hinson-Hasty & Isaac Yonemoto on Safer Native Code
<p>Everyone who's ever written a C NIF for the BEAM knows the story. You have a bottleneck, you reach for native code, it works - until one day it doesn't, and instead of a process crashing, the whole node goes down. A segfault in a NIF takes the entire BEAM with it, bypassing every fault-tolerance guarantee OTP was designed to provide.</p><p>This episode asks a simple question: do we have to accept that? The answer, increasingly, is no.</p><p>Allen Wyma and Francesco Cesarini sit down with Garrison Hinson-Hasty, author of Systems Programming with Zig, and Isaac Yonemoto, creator of Zigler - the library that lets you write Zig directly inside Elixir and Erlang modules, with automatic marshalling, scheduler-aware execution modes, and memory tracking that's visible to the BEAM itself.</p><p>This is part of the podcast's ongoing "right tool for the job" series, following earlier episodes on Rust and native code.</p><p>Topics include:</p><ul><li><p>what Zig is and why it exists - C's simplicity and zero-cost abstractions, without C's footguns</p></li><li><p>how Zig compares to both C and Rust: where it wins, where it loses, and why they're solving different problems</p></li><li><p>why Zig's allocator model is unusually well-suited for BEAM integration - and what it means that Zigler uses the BEAM's own allocator by default, making native memory visible to Erlang's VM</p></li><li><p>how Zigler works: write Zig in a sigil inside your Elixir module, and the marshalling between BEAM terms and native types is handled automatically at function call boundaries</p></li><li><p>the four execution modes Zigler gives you - normal, dirty CPU, dirty IO, spawned thread - and how to pick one without changing a single line of your Zig code</p></li><li><p>the honest answer to the question every BEAM developer wants to ask: can a Zigler NIF still crash the whole node? (Yes. Isaac explains exactly when and why, and what Zig's spatial memory safety actually buys you)</p></li><li><p>why Zig has no hidden control flow and no lexical macros, and why that matters when you're debugging something at the boundary between two runtimes</p></li><li><p>where Zig's async story currently stands, and what that means for Zigler's roadmap</p></li><li><p>Isaac's unusual professional position: CEO of a pharma startup who is also writing the software stack for his own lab in Zig and Elixir</p></li></ul><p>Recorded June 9, 2026.</p><p><strong>Resources mentioned:</strong></p><ul><li><p><em>Systems Programming with Zig</em> by Garrison Hinson-Hasty</p></li><li><p>Zigler on Hex and GitHub</p></li><li><p>Zigler docs</p></li></ul>