But changing the behaviour based on the presence, absence or value of an environment variable is hidden control flow.
For an entire program it’s fine and expected, but for a function, let alone a library, it should be configured by more explicit means.
If I want it to be based on an environment variable I will do that myself.
Most zig projects are libraries or applications, they should be abiding by my above explanation.
I absolutely agree that they should better support your use case, but I also don’t think it’s anywhere close to being unusable! It took me about 5 minutes in total to figure out how to get an Environ instance for each platform.
I understand that I am marginally more familiar with the juicy main, environ and args changes, and that it’s difficult on master where things change every day.
I encourage you to make an issue about the deficiency of this API for your use case, it won’t get better without feedback.
A common, and justified, misunderstanding is currently the std library is a toolbox for the compiler, the vast majority of it exists because the compiler needs/needed it.
Some other things are added, including important ecosystem abstractions like Allocator, Reader, Writer and Io. those are exceptions
It is made in a way to be used outside of the compiler, and things are kept after they are no longer used in the compiler as they are useful to others.
But in a language that is not stable, with a compiler that is not stable, you should not expect a stable and reliable toolbox of a std library.