▲ | KingOfCoders 7 months ago | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Exceptions are sum types, they just have different syntactic sugar. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
▲ | 9rx 7 months ago | parent | next [-] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Checked exceptions may be implemented as a sum type. Traditional exceptions are more likely to be a single type that wraps up a context object alongside stack trace information. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
▲ | 7 months ago | parent | prev | next [-] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
[deleted] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
▲ | pema99 7 months ago | parent | prev | next [-] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
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. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
▲ | veidelis 7 months ago | parent | prev [-] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
And different control flow, and different or sometimes non-existent types (Java's throws). |