|
|
|
|
|
by n_u
111 days ago
|
|
I think the argument is that the compiler does not enforce that the error must be checked. It's just a convention. Because you know Go, you know it's convention for the second return value to be an error. But if you don't know Go, it's just an underscore. In a language like Rust, if the return type is `Result<MyDataType, MyErrorType>`, the caller cannot access the `MyDataType` without using some code that acknowledges there might be an error (match, if let, unwrap etc.). It literally won't compile. |
|
> But if you don't know Go, it's just an underscore.
And if you don't know rust, .unwrap is just a getter method.