Comment

Comment by learc83

You can't which is a big part of the problem. You have to trust that the function will only return either and not both. Except in cases where a function does return both.

A maybe type would have been a much better solution. I wish people would just accept that go's error handling is a stopgap solution instead of pretending it's a good (or the best) solution.

I'd bet a substantial amount that go in 10 years ends up with pattern matching and sum types.

parent learc83 6 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton