Personally I think if your needs are so simple that you don’t need the build zig then zig run file.zig
is the tool for you and when that isn’t enough anymore, then using a build.zig
is fine with me.
I think there could be subtle things about that boundary and maybe changing little details about that could make the transition from one to the other better, but overall I would tend to agree with @IntegratedQuantum that it is probably more of a problem of either changing the build api (however I currently couldn’t say in which ways) or finding ways to explain it better to people who are unfamiliar with it.
It seems to me like people are too used to getting handed “magical” configuration interfaces where they can follow some tutorial that tells them:
- first you turn this knob
- then you put this string here
- then you set this value to that setting
- then you import this plugin from url bla
- then you select
"<your-feature-here>"
from this dropdown
- tada: here is your half broken half implemented game, that sort of does what you wanted, except the moment you want something slightly different, you have no idea what you would do to change it
I think these sorts of tutorials teach people a habit of wanting to follow a bunch of silly steps, over and over again, instead of understand and writing 20 lines of code once and be done with it and learning to be able to figure out stuff without needing a tutorial that specifically tells you how you accomplish this one particular thing.
Zig doesn’t want to do the many different silly configurations stuff, so reinventing features in the build.zig.zon
doesn’t make sense, it would just end up reinventing the exisisting api.
I don’t understand, if you don’t need a build.zig
then that is basically the “pristine tarball” strategy, where you just use the code without it having a build.zig
. But what you write sounds to me like you want zig to behave as if the init-generated build.zig
was present without you having one there, I think that would be against the zig zen in several ways:
- Favor reading code over writing code. (how do I read what is just implied and may even change with zig versions)
- Only one obvious way to do things. (now we have a weird default behavior)
- Incremental improvements. (incrementally improving an invisible implied file seems awkward)
- Avoid local maximums. (optimized the simple case, but slightly more complex case gets no benefit or is worse)
- Reduce the amount one must remember. (need to remember there is a default file)
- Focus on code rather than style. (there is one more file in my project, seems like a style issue to me)
Overall I think storage and networking bandwidth are a total non issue when you compare it to all these downsides that would give you code that implies too much and may even become difficult to run, because your loosing the explicit information of what should happen.
I think if bandwidth/storage is your concern, you could make a point about supporting fetching of packages from other protocols (for example content addressed protocols like some p2p networks or ipfs or similar things) so that those protocols can fetch from servers/nodes that are close to you, instead of half way around the world. And possibly use those also for de-duplication of redundant data.
But I think these storage concerns should be another discussion about possible improvements to package fetching and best practices that doesn’t have a huge impact on programmer workflow compared to what is already implemented.
I like the idea of content addressed online hosting of packages, but I am not sure about how these existing protocols work in practice, it is something that I find interesting but haven’t spend enough time trying out. I am also not super fond of things that rely on blockchain mechanisms, or bring a lot of complexity with them in the implementation.