▲ | pema99 a day ago | ||||||||||||||||||||||||||||||||||
Not really. Exceptions usually imply unwinding the stack, and the ability to catch at any point throughout the callstack. Result types are just 'dead' data. | |||||||||||||||||||||||||||||||||||
▲ | zozbot234 a day ago | parent [-] | ||||||||||||||||||||||||||||||||||
These are fully equivalent in outcome, though often not low-level implementation. You can use try...catch (called panic...recover in Go) to pack a normal and abnormal return case into the equivalent of a Result<> type. Or just pass an abnormal Result<> back to the caller to manually unwind a single "layer" of the call stack. | |||||||||||||||||||||||||||||||||||
|