I love the simplicity of Zig but one think irks me: “errors for unused things”.
When Andrew promoted this “feature”, majority of the reactions were downvotes.
People in the issue thread explained that this makes the language difficult to use, and most importantly makes the code difficult to debug.
Moreover when working in a corporate environment and being under stress of deadlines, it is annoying to fix such “safety feature induced errors”, instead of fixing our code.
Some might argue that there are perfectly valid reasons for these errors. There are not. They are harmful to our productivity and only serves to increase friction while trying to implement / fix something. Some might argue that if the errors were disabled everyone would write bad code. No. We only want the errors to be turned into warnings while in Debug mode. In Release mode these can be errors and we would understand why.
Since even after so many people saying that this is harmful to our productivity, the Zig dev team has not listened to our views. It might be necessary for someone to compile a fork of Zig compiler where the “errors for unused things” are turned into warnings.
At least we can use the forked compiler do our work in peace.
Forking the compiler is dangerous, as it has a chance of splitting the community, to the point where some libraries may not even compile with normal Zig anymore.
So if you really can’t live with these errors I would suggest a less invasive action: You could use the build system to preprocess the source files, copying them to a new location and automatically inserting _ = x after all unused variables or _ = &x to also cover var vs const. This may seem more difficult than just patching the compiler, but this has the advantage that you can use a regular Zig compiler. This preprocessor could even be shipped through the package manager, easily accessible by any project.
This is also how other controversial Zig features (tabs were forbidden at some point) were addressed in the past.
This post serves no purpose but to generate angst, division and dig up old grievances over a long past “controversy”, And I really don’t see any value to it.