Hacker Read top | best | new | newcomments | leaders | about | bookmarklet login

>Go prevents you from compiling with unused variables, and that combined with the Go documentation goes a long way towards teaching new Go programmers how they're expected to work.

Things like this make me not want to use a language. Want to comment a=b; to a=3;//b temporarily? Too bad, either assign b to 3 or comment out b too, and if b was the only variable to make use of c, same for c, and so on. Same obnoxious nonsense as Java not letting unreachable code exist, making me have to comment out the rest of the function body if I want to put in a return in the start to test something, which happens often enough that it's a pain.



view as:

You can always use the black hole variable _

That mild inconvenience (which I almost never face while writing Go code after getting accustomed to the language and getting my editor to run goimports on save) has a big RoI in safety and program quality, which are much loftier goals than short term code-writing convenience.


I doubt the RoI is much more than if these were just suppressible warnings instead of errors, which work out great in C#.

>which work out great in C#.

They're greatly ignored in the real world.


Legal | privacy