Sammendrag
A “thrown” exception is a non-local side effect that complicates static reasoning about code. In some programs errors are instead propagated as ordinary values. Such propagation is sometimes done in monadic style, and some languages include syntactic conveniences for writing expressions in that style. We sketch a language-based failure management approach in which error-monad-resembling transparent error value propagation is made the language default. The approach accommodates language designs with all-referentially-transparent expressions, and syntactic conveniences resembling those of traditional exception mechanisms. Our proof-of-concept implementation of the approach is furthermore capable of automatically checking data invariants and function pre- and post-conditions, recording a trace of the failed or unevaluatable expressions caused by an error, and in some cases retaining “bad” values for potential use in recovering from an error.
Vis fullstendig beskrivelse