You must log in or # to comment.
This is quite interesting, since the article states absolutely nothing about Go language.
Since, it’s the most common or even fairly standard technique in the language:func Hello(name string) (string, error) { // If no name was given, return an error with a message. if name == "" { return "", errors.New("empty name") } // ... }Go’s val, err := maybeDoThing() pattern isn’t the same thing because it’s not a discriminated union like Rust’s Result or C++'s std::expected or the Typescript example in the article. Moreover, due to restrictions in Go’s generics, it’s impossible to implement what is imo the most attractive pattern enabled by the discriminated union Result types - monadic operations.
Ditto for rust, although I didn’t read the article to know if they mentioned that one lol
Thank you! Apparently, they did not mention Rust, too ^^"



