1 comment

[ 4.4 ms ] story [ 15.0 ms ] thread
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