Don't Forget to Flush by Andrew Kelley [video]

8 rene_d 2 8/11/2025, 5:23:30 PM youtube.com ↗

Comments (2)

ivanjermakov · 3h ago
I wonder how Zig will tackle ergonomics of parameter cluttering. I imagine most function signatures end up looking like so:

    fn foo(allocator: Allocator, io: IO, ...) !... {}
It's great in that it's explicit on what function is about to do (heap allocation and other i/o), but someone has to type all of that...

I think Odin went with implicit context system[1], making some state accessible across function boundaries, but it seems to be against Zig's philosophy on explicit control flow.

In practice it might end up being not a big deal, especially considering that both allocator and io can be shoved into struct's fields:

    fn foo(self: *Bar) !... {
        _ = self.allocator;
        _ = self.io;
    }
Props to Andrew for going against the grain and making unorthodox decisions - the only way to get out of the local minimum.

[1]: https://odin-lang.org/docs/overview/#implicit-context-system

ozgrakkurt · 7m ago
Afaik the new recommended pattern is to have “unmanaged” apis so structs don’t keep allocators inside but take it in every function call.

Passing an extra argument for allocator is fine in my experience, it doesn’t really take much time to write it down and it is nice to be able to see if a function does allocation from it’s signature alone