3 ms·
>>But it, and, more importantly, the use requirement for variables, has saved me from bugs repeatedly; So how is it better than C where you get a warning (at l
by bluecalm 10y ago
>>But it, and, more importantly, the use requirement for variables, has saved me from bugs repeatedly;
So how is it better than C where you get a warning (at least from GCC) that you have unused variables? You can quickly test things and you are coming back to fix all the warnings later anyway.
- tptacek 10y agoYou get warnings for lots of things in C. There's no getting around the use requirement in Go, at least not without crudding up your code.
- StavrosK 10y agoI prefer what I do with Python in this regard: The IDE shows me unused variables, I can run my code with them, but I can't commit since the linting hook will produce a hard error at commit-time if something's wrong. It's not as easy to do with a compiled language, of course, but I don't think it would be over the top to have the compiler exit with a non-success code if there are warnings when building. The "warning fatigue" you get from C is because the warnings are either about false positives or about things that are too trivial to bother with, not because of a property inherent in compiler warnings themselves.
- wtbob 10y ago> I prefer what I do with Python in this regard: The IDE shows me unused variables, I can run my code with them, but I can't commit since the linting hook will produce a hard error at commit-time if something's wrong. The problem is that while you do that, essentially no-one else on the planet does — and anyone who uses a library thus has to deal with the fact that that library has approximately a 100% chance of having nits like unused variables.
- StavrosK 10y agoYes, it's true that sane defaults are supremely important.