Skip to content

Comment on Discussion: Reduce error handling boilerplate in Golang using '?'parent

Comments

I think what I meant is that out of these three ways to do it, I don't like the second one:

1. The language has the feature of returning multiple values, which is then used in an error handling pattern.

2. The proposal is about special syntax for that pattern

3. Languages that have generics (like Go) can instead implement a Result type, turning this pattern into more readable code without the extra syntax.

I feel like a Result type would have more advantages and be less disruptive than a syntax macro for a pattern, but I'm not sure.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.