about things
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

zig 0.16: add std.Io interface notes

- new 0.16/ directory for upcoming release
- io.md: std.Io interface, async vs concurrent, no function coloring
- sources: kristoff.it, andrewkelley.me, porting guide

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

zzstoatzz 99210371 53f42752

+88
+7
languages/ziglang/0.16/README.md
··· 1 + # zig 0.16 2 + 3 + major themes: async I/O and aarch64 backend. 4 + 5 + ## notes 6 + 7 + - [io](./io.md) - std.Io interface, async/concurrent, no function coloring
+78
languages/ziglang/0.16/io.md
··· 1 + # i/o 2 + 3 + 0.16 overhauls I/O with the `std.Io` interface. everything that can block (filesystem, networking, timers) moves to this interface. 4 + 5 + sources: [kristoff.it](https://kristoff.it/blog/zig-new-async-io/), [andrewkelley.me](https://andrewkelley.me/post/zig-new-async-io-text-version.html), [porting guide](https://sheran.sg/blog/porting-dns-from-zig-0.15-to-0.16/) 6 + 7 + ## std.Io interface 8 + 9 + like `Allocator` for memory, `Io` is passed to functions that do I/O: 10 + 11 + ```zig 12 + fn fetchData(io: std.Io, allocator: Allocator) ![]u8 { 13 + // io provides networking, timers, etc. 14 + } 15 + ``` 16 + 17 + this decouples code from execution model. same code works with threads, event loops, or blocking I/O. 18 + 19 + ## async vs concurrent 20 + 21 + two primitives with different semantics: 22 + 23 + **async/await** - operations *can* happen independently. infallible, works on limited implementations: 24 + 25 + ```zig 26 + const future = io.async(someFunction, .{args}); 27 + // ... do other work ... 28 + const result = future.await(); 29 + ``` 30 + 31 + **concurrent** - operations *must* happen simultaneously for correctness. can fail: 32 + 33 + ```zig 34 + const future = io.concurrent(someFunction, .{args}) catch |err| { 35 + // error.ConcurrencyUnavailable on single-threaded systems 36 + }; 37 + ``` 38 + 39 + use `async` when you want asynchrony. use `concurrent` when you need parallelism. 40 + 41 + ## no function coloring 42 + 43 + `async` and `await` are library functions, not keywords. no viral async/await infection through call stacks. any function can be called with `io.async()`. 44 + 45 + ```zig 46 + // foo is a normal function 47 + fn foo(io: std.Io) !void { ... } 48 + 49 + // can be called normally 50 + try foo(io); 51 + 52 + // or asynchronously 53 + const future = io.async(foo, .{io}); 54 + ``` 55 + 56 + ## std.net moved 57 + 58 + networking moves from `std.net` to `Io.net`: 59 + 60 + ```zig 61 + // 0.15 62 + const addrs = try std.net.getAddressList(allocator, hostname, 0); 63 + 64 + // 0.16 65 + const future = io.concurrent(Io.net.HostName.lookup, .{...}); 66 + // results come through a queue 67 + ``` 68 + 69 + ## what doesn't change 70 + 71 + `std.Thread.Mutex`, atomics, and low-level threading primitives remain. `std.Io` is a higher-level abstraction built on top of them. you still need mutexes when multiple threads access shared state. 72 + 73 + ## implementations 74 + 75 + - `std.Io.Threaded` - thread-based, no event loop 76 + - other implementations possible (io_uring, kqueue, etc.) 77 + 78 + the interface is concrete, not generic - same benefits as 0.15's explicit buffer approach.
+3
languages/ziglang/README.md
··· 5 5 ## topics 6 6 7 7 - [0.15](./0.15/) - version-specific patterns (i/o, arraylist, crypto, testing) 8 + - [0.16](./0.16/) - std.Io interface, async/concurrent (preview) 8 9 - [build](./build/) - build system patterns from large projects 9 10 10 11 ## sources ··· 16 17 | [music-atmosphere-feed](https://tangled.sh/@zzstoatzz.io/music-atmosphere-feed) | bluesky feed generator | 17 18 | [find-bufo](https://tangled.sh/@zzstoatzz.io/find-bufo) | bluesky bot | 18 19 | [leaflet-search](https://tangled.sh/@zzstoatzz.io/leaflet-search) | fts search backend | 20 + | [pollz](https://tangled.sh/@zzstoatzz.io/pollz) | bluesky polls (zqlite + transactions) | 19 21 | [zql](https://tangled.sh/@zzstoatzz.io/zql) | comptime sql parsing | 20 22 | [zat](https://tangled.sh/@zzstoatzz.io/zat) | atproto primitives (jwt, crypto) | 23 + | [prefect-zig](https://tangled.sh/@zzstoatzz.io/prefect-zig) | prefect orchestration server | 21 24 | [ghostty](https://github.com/ghostty-org/ghostty) | terminal emulator (build system) | 22 25 | [bun](https://github.com/oven-sh/bun) | javascript runtime (build system) | 23 26