Exploring the error handling concepts for programming languages
This is a follow-up to my previous post about concepts in programming languages , expanding the analysis to explore concepts around errors: raising, detecting and handling them. It turns out that error handling isn't necessarily a separate concept, there is only one concept necessary for error handling: Selection - Purpose : Allows a choice of which units to process and which to ignore. Operational Principle : If you specify the selection criteria, the matching units will be processed. The failing code selects whether to error or not and the calling code selects on the result how to proceed. When execution of some code can result in an error instead of a result of the expected kind, it is extremely useful for programmers to know about it, so another important, though not strictly necessary, principle is: Documentation - Purpose : Allows communicating aspects of the design and purpose to a future reader of the program. Operational Principle : If you specify the relevant inform...