4 ms·
How automatic it is depends on the language, but error "objects" (rather than codes) can do this too. It is pretty great.
by dwattttt 2y ago
How automatic it is depends on the language, but error "objects" (rather than codes) can do this too. It is pretty great.
- layer8 2y agoYes, with enough syntactic sugar it can become equivalent. Exceptions can be viewed as sum types with special syntactic sugar in conjunction with the regular return types, and can in principle be implemented as such. When I say "exceptions", I mean the source-level semantics, not how it's implemented behind the scenes.