Hacker News new | ask | show | jobs
by aikah 2810 days ago
> I'm not sure about that. Rust's use of a Result type instead of exceptions is one of my favourite things about Rust.

It works because Rust has pattern matching and generics as well. Just having a Result type isn't going to help with error handling much, and Go is not getting generics Rust style nor pattern matching any time soon.

Let us be reminded that Go errors as values are purely a convention, nothing in the language mandates their use. On the other hand panic/defer/recover are language constructs.

1 comments

Exactly the same with Scala.

Option types demand pattern matching and similar techniques for working with those types. Otherwise you just have "if (x.isDefined) a else b" blocks of code everywhere.