The more I use sum types for error handling the more convinced I am that exceptions are very good, actually.
-
Show this thread
-
Replying to @DRMacIver
So, a failure mode I've run into (with a C++ port of Rust's Result) is where the error type is effectively unit, and code just tosses it up the stack, and eventually something asserts… but without the info from the part of the stack that was discarded.
2 replies 0 retweets 0 likes -
Replying to @xlerb
Right, exactly. Sum types for errors generally carry radically less information than the corresponding exception would - no error message or stack trace.
2 replies 0 retweets 2 likes -
Replying to @DRMacIver @xlerb
This is simultaneously the best and worst parts of manual error handling. When I write Go, for example, I manually wrap nearly every error with hand-crafted context and provenance. It’s wonderful. But now Go code I interact with does no such thing. It’s awful.
1 reply 0 retweets 0 likes -
Also simultaneously the best and worst parts of exception handling. When I write code in a language with exceptions, almost nobody, myself included, does the work of customizing provenance and context. Despite the convenience, just stack traces is eventually not good enough.
1 reply 0 retweets 1 like
At ITA, we used to have macros that would use dynamic binding of variables and condition handlers to introduce debugging frames with a human-readable explanation of the evaluation context. That was great for debugging and logging.
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.
Read my blog!