Hacker News new | past | comments | ask | show | jobs | submit login

See the example with the `?` operator: https://github.com/borgo-lang/borgo?tab=readme-ov-file#error...

The main benefits of a Result type are brevity and the inability to accidentally not handle an error.




Yes, but that isn't necessarily a feature of option types. Is it the case that similar sugar for the tiresome Go pattern couldn't achieve similar benefits?


Perhaps, but there have been several proposals along those lines and nobody seems capable of figuring out a sensible implementation.

A funny drawback of the current Go design that a Result type would solve is the need to return zero values of all the declared function return types along with the error: https://github.com/golang/go/issues/21182.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: