News for hackers. Stuff that matters.
Re:Go 1.18 by kevinmgranger on Tuesday March 15, 2022 @10:45PM (#30694738)
Right, so the concept in Go is misnamed. It's not Errors are Values, it's Errors Have Normal Control Flow.

Returning errors makes many things more manageable, definitely. But where they really shine, like in the mapping example, isn't possible in Go. Unless I'm mistaken with how go generics work.

(By the way, I'm a huge fan of how error handling works in Rust and other related functional languages. Definitely not advocating for the classic way of doing Exceptions).

Re:Go 1.18 by uryga on Wednesday March 16, 2022 @05:09AM (#30696727)
> But where they really shine, like in the mapping example, isn't possible in Go.

oh yeah, definitely! Go's version of EaV with multiple returns is pretty lackluster compared to a proper Result type. afaict it's kind of "the worst of both worlds" -- all of the boilerplate of plumbing errors manually w/ none of the benefits.

Re:Go 1.18 by kevinmgranger on Wednesday March 16, 2022 @11:59AM (#30700444)
Folks are saying that sum types might eventually come to go after some experimenting with generics. It'll be interesting to see where it goes.