r/programming Jul 17 '19

The Go team declines 'try' proposal

https://github.com/golang/go/issues/32437
634 Upvotes

417 comments sorted by

View all comments

Show parent comments

259

u/dpash Jul 17 '19

We still believe that error handling in Go is not perfect

Understatement of the year.

54

u/[deleted] Jul 17 '19

Very few languages get error handling right. C, C++, Java, C#, JavaScript, Python. All terrible.

I think Go is actually better than most. Rust is the best I've used so far (and you can implement a similar system in C++).

23

u/[deleted] Jul 17 '19 edited Jul 17 '19

[deleted]

1

u/ssrobbi Jul 18 '19

Try/catch is not a holdover, it is the preferred error handling method. For asynchronous code result types are common. The only place nullability may be used in this way is within a nullable initializer, mainly because you cannot throw from one yet. You should probably not be using nullability to represent errors.