▲ | kristoff_it a day ago | |||||||||||||
> Zig's handling of unused variables seems like an unforgivably bad design choice to me. Its been raised by the community plenty of times. Why hasn't it been fixed? Because yours is just an opinion. It's perfectly legitimate to not like unused variable errors, but its factually wrong to say that no one wants it. You're just yucking somebody else's yum. > But does he seriously not have any smart people around him who he trusts who can talk him out of this design? He does, most of them also like unused variable errors. For what it's worth, I do too. | ||||||||||||||
▲ | defen a day ago | parent | next [-] | |||||||||||||
The unused variables thing seems like it's downstream of "no warnings, only errors". That is, once you're committed to errors-only, then unused variables are either an error, or not. And if those are your only two choices, then errors sound better. However, I've written a decent amount of Zig code and that's probably my biggest complaint. Zig has put a ton of effort into making an ultra-fast developer experience with very low iteration times, and it's amazing. But then when I'm refactoring some code or trying to figure stuff out by, for example, commenting out some lines of code, I might get a bunch of unused variable errors. And so I spend more time fixing those than I do even compiling the code itself! One thing I've seen suggested is using the linter to automatically insert `_ = foo` for unused variables, but I don't love that either because then what even is the point of the error in the first place? But like I said that's all downstream of the no-warnings policy. And I totally understand the failure mode of warnings - I've worked on plenty of large projects that had 4,000 warnings and everyone ignored them and the actually useful ones would be invisible. Is there some middle ground where, I don't know, Debug builds can have warnings, but Release builds don't? | ||||||||||||||
| ||||||||||||||
▲ | josephg a day ago | parent | prev [-] | |||||||||||||
In that case, can you help me understand the logic behind it? The more time I spend thinking about it, the more convinced I am that its strictly worse. What am I missing? Why do you like it? | ||||||||||||||
|