Carrying dependencies

I agree. I wrote a linter rule for zlinter to disallow global variables https://github.com/KurtWagner/zlinter/blob/0.16.x/src/rules/no_global_vars.zig. They might be a neccessary evil sometimes, but even then I recommend encapsulating the global state into a struct and exposing a global instance variable.

Such as:

const SomeState = struct {
    foo: u32,
    bar: u64,

    // zlinter-disable-next-line no_global_vars - Unfortunately the underlying API relies on global state
    var instance: @This() = .{ ... };
};
3 Likes