Migrate to Zig 0.15.2 - #122
Conversation
This migrates the entire codebase from Zig 0.14.1 to Zig 0.15.2. Key API changes: - Remove `usingnamespace` (removed from the language) — all mixins now use explicit re-export of each declaration - `ArrayList.init(allocator)` → `.empty` + pass allocator to each method call (deinit, append, appendSlice, etc.) - `callconv(.C)` → `callconv(.c)` (lowercase enum literals) - `std.os.windows.WINAPI` → `std.builtin.CallingConvention.winapi` - `std.fmt.allocPrintZ` → `std.fmt.allocPrintSentinel` - `std.atomic.Atomic` → `std.atomic.Value` - `std.sort.sort` → `std.mem.sort` - `std.time.sleep` → `std.Thread.sleep` - `SinglyLinkedList` became intrusive (compat wrapper added in data.zig) - `BoundedArray` removed (compat replacement in containers.zig) - `anyframe` removed (async.zig stubbed) - `std.Uri.path` API changes (toRaw signature) - format function signatures changed - zigimg StreamSource → ReadStream API Also updates: - vendor/zigwin32 for 0.15.2 compatibility - build.zig / build_capy.zig for 0.15.2 build API - build.zig.zon dependency hashes (zig-objc, zigimg) - flake.nix / flake.lock for Zig 0.15.2 toolchain All 28 examples compile successfully on both x86_64-windows-gnu (cross-compile) and native macOS (aarch64-macos).
|
I'm newish to Zig, and I'm finding that Zig upgrade PR's are beasts. (Ghostty apparently had a ton of required updates, too.) It's possible that you might not want to go through this pain again for 0.16 and will want to wait for that (likely this year) to drop. If you want, we can just leave this open as the "comprehensive upgrade PR" and just update it for 0.16 when that's appropriate. |
|
A more general thing is that the |
|
ah, makes sense, then you get the upstream whenever you update. will rejigger it |
|
@zenith391 and @pmarreck Zig 0.16 has been released. Is the intention still to make one migration to 0.16? If so, can this be picked up? |
|
I've upgraded all of my personal Zig projects to 0.16 but regarding Capy specifically, I've chosen a different solution for now on my cross-platform projects (GPUI with gpui-component, same things the Zed editor uses, and even though it is Rust, I came up with a way for it to call into my Zig core code that works great) so I have personally lost motivation in pursuing Capy dev anymore for now since it still needs a lot of work and GPUI works great |
|
Also, just an opinion here, it would've been absolutely infeasible for me time-wise to upgrade all of my Zig projects to 0.16 without AI assistance, so there's that. I know the Zig community has… thoughts… on frontier LLM use, but for really boring/mechanical things like making CI pass or... upgrading dependencies to newer versions and then fixing all the new fails... it is absolutely superb |
|
This is why I stopped chasing Zig upgrades. I will wait for the flailing to stop before investing more time in it. Stopping at 0.15.2 and then waiting for something Capy needs from a Zig update before making the next upgrade will be less work overall. The same technique held true in the whole industry for upgrades to the C standards. Not many are jumping to C23. There just are not any compelling benefits to justify dropping C11 feature and syntax (and therefore C17) compatibility and breaking the longstanding backward compatibility and refactoring stable code for no returns. Much more code is still generated in C99 and C11/C17 than C23. So far, the draft for C29 looks interesting since it is absorbing some Rust and Zig innovations, such as defer, so migrating standards every 18 years might be the new pattern. On Aug 2, 2026, at 7:53 AM, Peter Marreck ***@***.***> wrote:pmarreck left a comment (capy-ui/capy#122)
Also, just an opinion here, it would've been absolutely infeasible for me time-wise to upgrade all of my Zig projects to 0.16 without AI assistance, so there's that. I know the Zig community has… thoughts… on frontier LLM use, but for really boring/mechanical things like making CI pass or... upgrading dependencies to newer versions and then fixing all the new fails... it is absolutely superb
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
|
Yep, I hear that. And I was planning on doing the same (basically waiting on, say, a 0.16.1 point release) but as it turned out, a lot of the Zig deps I needed all went to 0.16 and not doing so suddenly became a liability for a pre-product launch so I decided to have the LLM write an upgrade guide https://gist.github.com/pmarreck/5424b5ecb0744f2c9641b83c4043afb8 and handed that to an agent’s context that was assigned to upgrade a project, and that worked out great. |
|
@pmarreck can I pick up from this branch and migrate capy to 0.16? |
|
@TeeEnnEnn Of course! |
Summary
This migrates the entire codebase from Zig 0.14.1 to Zig 0.15.2. No new features or behavioral changes — this is purely a language/API migration.
This is the first of several focused PRs that replace the monolithic #121 (which the maintainer correctly identified as too large to review).
Key API changes
usingnamespaceremoval — replaced with explicit re-exports for every mixin declaration throughout components, backends, and examplesArrayListAPI —.init(allocator)→.empty+ pass allocator to each method callcallconv(.C)→callconv(.c)(lowercase enum literals)std.os.windows.WINAPI→std.builtin.CallingConvention.winapistd.fmt.allocPrintZ→std.fmt.allocPrintSentinelstd.atomic.Atomic→std.atomic.Valuestd.sort.sort→std.mem.sortstd.time.sleep→std.Thread.sleepSinglyLinkedListbecame intrusive (compat wrapper added),BoundedArrayremoved (replacement added)anyframeremoved (async.zigstubbed since the async subsystem was already incomplete)std.Uri.path.toRawsignature changedStreamSource→ReadStreamAPITest plan
x86_64-windows-gnu(cross-compile)