Hacker News new | past | comments | ask | show | jobs | submit login

Zig treats unused variables as a syntax error.



Lets say I gather Diag data, which I conditionally print during testing. Are you saying that I cannot leave the diag code in place after I comment out the print function? Thats unproductive and a major obstacle to using Zig. I’m still pissed at Andrews stance of preventing Tabs, operator overloading, polymorphism, and this just seals my “stay away” stance. I really do want to like Zig, but cannot.


You don't need to comment out the print function - it could gate its behavior on a comptime-known configuration variable. This would allow you to keep your debug variables in place.


It doesn't need to though. It goes out of its way to determine that the variable is unused.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: