IssueRaiser

> The difference seems to be that Go has a preferred way to do it: explicit case analysis and early returns.

> The difference seems to be that Go has a preferred way to do it: explicit case analysis and early returns. In other words, there is no way to abstract over the case analysis in Go. It sounds like you're saying this is a good thing. I think it's bad. > ... apparently the Rust folks can't make up their minds Wow, I'd say the opposite. In Go, the only thing all `error` objects have in common is the `Error()` method, which returns a description. If you want to investigate the causal chain of an error (to achieve what stack-traces give you in languages with exceptions), there is no standard way , even for errors in the standard library. Some errors are basically just strings, others are structs with other fields that you can access by using runtime type assertions. Rust, on the other hand, has the `Error` trait, which includes a `cause` method, returning the underlying error if one exists. This alone seems to me like an improvement in consistency over Go.

Posted by maxbrunsfeld on May 14, 2015, 6:10 PM

Tags

Related issues

Raise real-world problems, find people facing the same issue, and discuss solutions.6,500 issues0 comments

hackernews (Software)

> The difference seems to be that Go has a preferred way to do it: explicit case analysis and early returns.

maxbrunsfeldMay 14, 2015, 6:10 PM

> The difference seems to be that Go has a preferred way to do it: explicit case analysis and early returns. In other words, there is no way to abstract over the case analysis in Go. It sounds like you're saying this is a good thing. I think it's bad. > ... apparently the Rust folks can't make up their minds Wow, I'd say the opposite. In Go, the only thing all `error` objects have in common is the `Error()` method, which returns a description. If you want to investigate the causal chain of an error (to achieve what stack-traces give you in languages with exceptions), there is no standard way , even for errors in the standard library. Some errors are basically just strings, others are structs with other fields that you can access by using runtime type assertions. Rust, on the other hand, has the `Error` trait, which includes a `cause` method, returning the underlying error if one exists. This alone seems to me like an improvement in consistency over Go.

Comments (0)

No comments yet. Start the discussion.

Comment on this issue