News for hackers. Stuff that matters.
Re:Why I’m not leaving Python for Go by dmpk2k on Sunday September 23, 2012 @10:09PM (#4562895)
I don't know about Go, but lint is commonly used to enforce checking of return values in C. Presumably Go could bake an option into the compiler to enforce this too.
Re:Why I’m not leaving Python for Go by luriel on Sunday September 23, 2012 @10:45PM (#4562974)
In Go unused variables are an error, so you are forced to either handle errors or explicitly ignore them (by assigning them to _).
Re:Why I’m not leaving Python for Go by Djehngo on Monday September 24, 2012 @06:38AM (#4563991)
Sort of, you can actually get away with invoking a function and not assigning its result at all

I think assigning the error to _ is only necassary when you have multiple return values(one of which is the error) and you are interested in at least one of them.

e.g.

    returnsTwoValues()
is legal

    x := returnsTwoValues()
is not

maps are also interesting because

    value := someMap[key]
is valid and

    value, keyIsPresent := someMap[key]
is also valid.