News for hackers. Stuff that matters.
Re:Why Go Can't Try by maccard on Monday March 02, 2026 @01:47PM (#47222259)
> 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.)

I think you can make the same argument here - rust provides unwrap and if you don’t know go, that’s just how you get the value out of the Result Type.

Re:Why Go Can't Try by qezz on Monday March 02, 2026 @03:24PM (#47223567)
The big difference is that with `(T, error)` as a return type, any value on the caller side will look like a valid one (thanks to zero values).

  a, err := f()
  // whether you forgot to handle the `err` or not, 
  // the `a` carries a zero value, or some other value.
In rust it's not the case, as the `T` in `Result<T, E>` won't be constructed in case of an error.
Re:Why Go Can't Try by zimpenfish on Friday March 06, 2026 @06:29PM (#47282490)
> "the `a` carries a zero value, or some other value."

Or you could return pointers and use `nil` in the error case. Bonus is that it'll then panic if you try to use it without checking the error.

(Yes, I know, it makes everything else a faff and is a silly idea.)