Re:What's coming in Go 1.12 [slides]
by erik_seaberg on Friday November 02, 2018 @08:47PM
(#18367963)
You can return (string, error), but then what? You can't send them over a chan (string, error) or append them to a [](string, error). You can work around this by defining a bunch of struct types, but that's exactly what multiple return values was trying to avoid, and making a human being read and write that boilerplate is far more expensive than having the compiler supply it.
[ Parent
| on HN ]
Re:What's coming in Go 1.12 [slides]
by partiallattice on Saturday November 03, 2018 @12:54PM
(#18371186)
So much this. Every time I want to make a function async, I have to write my 5010th `ErrorOr` struct to send over a channel. Even if they would only add the multiple return hack to channels, that would save me a bunch of pain.