Were multiple return values Go's biggest mistake?

38 points by mond


telemachus

On the one hand, the author offers several specific cases where tuples would simplify and improve Go. For example, it would be great to replace custom (and varied) Result struct types with (value, error) tuples. Also, this section really struck home for me.

Go cannot handle the case of iterating over one or two values in a uniform, parametrized way. It requires duplicate definitions, one for handling one value at a time, and one for two values.

    for val := range foo { ... } // you can do this
    for k, v := range foo2 { ... } // this requires a different api
    for x1, x2, x3 := range foo3 { ... } // this is literally impossible in Go

Why?

On the other hand, Go continues to bring out the worst in people.

I don’t want to sound mean, but a friend of mine has suggested that he believes that “Rob Pike invented Go as a practical joke.”, and things like this really make me wonder if he has a point. Why would you design a language where the result of a function call cannot be stored or passed around?

My serious suggestion: if you find yourself writing “I don’t want to sound mean,” then immediately stop and delete the sentence. Just don’t say it. It almost never helps. It’s almost never as funny or clever or insightful as you think it is.

Unrelated, but small typo: s/fool’s errant/fool’s errand/