Re:Zig 0.12.0 Release Notes
by AndyKelley on Saturday April 20, 2024 @05:29PM
(#40101190)
> It's completely useless
It seems like you're forgetting that it shows up in diffs (code reviews) and text editors.
Thanks for reminding me, it does bloat up the code and require nitpick review comments if you catch it, and useless churn afterwards if you don’t and need to fix the code later on.
So it’s worse than useless, it’s actively harmful.
> Boy am I happy not to work with you.
It wasn't my decision to introduce such draconic rules, but in practice it turned out to be a non-issue. Production code should be warning-free, and warnings should be treated as errors. Two simple rules that both make a lot of sense, no matter what language.
PS: that 'unused variables are errors' linter rule is actually coming from the airbnb eslint plugin (which AFAIK is quite popular in the JS/TS world: https://github.com/airbnb/javascript/blob/c25bce83be4db06e6a...)
Except yes, and your clarifications confirm it. If the formatter automatically adds and removes artificial uses for unused variables then you're undermining the diagnostic since you're automatically suppressing it. It's completely useless. Worse than useless even.
Not to mention zig's diagnostic is as crap as go's: it doesn't track unused stores, so it only catches a minuscule number of possible issues, and misses the much larger one, yielding both incredible annoyance and false confidence, all because the maintainers of both languages refuse to support warnings.
> It's also trivial to search for the "_ =" discard pattern to find any leftover discards (in a 'final' codebase there shouldn't be any of those).
Meanwhile a warning actually tells you directly and reminds you, without having to "search for the discard pattern".
> Nope, in our case it's an actual hard compile error.
Boy am I happy not to work with you.