News for hackers. Stuff that matters.
Re:Why I love Go by TheDong on Tuesday December 05, 2017 @08:21PM (#15857755)
None of that helps with the real problem of golang errors.

The real problem with go's errors is complex and significant.

There's no Either/Result type so the multiple return doesn't actually tell you that you get a zero value when there's an error (and in fact there are functions in the stdlib that do this).

There's no good way to check whether an error is a given thing because error chaining isn't built in and errors rarely are typed as sum-type-enums as they are in rust or other decent functional languages. For example, `os.IsNotExist(err)` will not work for a caller if I did `return fmt.Errorf("error opening file: %v", err)` in a function.

The stdlib encourage a dozen really bad methods of doing error handling; there's `io.EOF` (which is a mutable variable btw). There's PathError. There's os.IsNotExist. There's random panics in some functions. There's nil returns with no further info.

The stdlib has multiple examples of 3 or 4 different error handling styles, and they're all horrific because they don't chain and don't allow for exhaustive matching.

Go may be good compared to C or other languages that were designed way back when. In modern times, go is a massive step backwards with its incredibly underwhelming type system, absolutely asinine community, lack of good abstractions, and so on.

Re:Why I love Go by alien_at_work on Wednesday December 06, 2017 @07:46AM (#15860654)
Exactly right. If all computer languages were created anonymously, Go would be less popular than BF.