News for hackers. Stuff that matters.
Re:Go 1.8 Release Notes by nine_k on Thursday February 16, 2017 @03:30PM (#13663300)
Adding tuples (value, error) and / or optionals would be a better way.

But that would require either more special-case magic (always bad), or generics (not in 1.x, supposedly).

Re:Go 1.8 Release Notes by prodigal_erik on Thursday February 16, 2017 @06:17PM (#13664525)
Even a special-case Result<T, E> in the language would be far more useful than multiple return values simply because you could pass it through a channel or a slice.
Re:Go 1.8 Release Notes by weberc2 on Thursday February 16, 2017 @03:51PM (#13663469)
> Adding tuples (value, error)

Like https://godoc.org/net/http#Get?

Re:Go 1.8 Release Notes by nine_k on Thursday February 16, 2017 @04:09PM (#13663594)
Returning multiple values is the norm. But these values are immediately unpacked, cannot be passed around as a whole, or have methods.

It would be great to have something like a conditional return to get rid of the endless `if err != nil`, or, while we're at it, from endless `.then` that futures-based programming ends up with:

    foo_result, err = foo(...)
    on_failure(err, "foo failed")
    bar_result, err = bar(foo_result, ...)
    on_failure(err, "bar failed though foo did not")
    return bar_result + 1
Re:Go 1.8 Release Notes by weberc2 on Friday February 17, 2017 @04:04PM (#13671696)
I've never found `if err != nil {` to be a problem; on the contrary, it draws my eye right to the error-handling logic in any function. OTOH, exceptions tend to obscure this (in the best case you have checked exceptions and you are only unsure about which function is raising the exception; at worst you have something like Python where you have no idea what exceptions could be thrown or if they're handled properly), and Rust's `try!` tends to blend in too well with its surroundings (this is a special case of Rust's density making it hard to read). YMMV.