2 ms·
Perhaps some taxonomy is required to help us deal with this. Some errors are essential/problem domain errors. They represent an impossibility with regards to t
by jacques_chester 14y ago
Perhaps some taxonomy is required to help us deal with this.
Some errors are essential/problem domain errors. They represent an impossibility with regards to the purpose of the code. I place validation code under this heading.
Some are accidental/solution domain errors. They represent a failure of the environment or computing platform. They are present to allow the code to decide what to do when a design assumption (network availability, disk availability, RAM availability etc) is broken.
There's also the question of who must handle the error. Exceptions allow errors to propagate up a stack. Both C-style and multivalue return error handling styles force inline handling. Common Lisp conditions allow out-of-band error handling (some other agent freezes execution and steps in).
To me the core problem is this:
1. Error handling obfuscates the purpose of a piece of code. It hides the happy case and alternative cases.
2. Error handling is an unavoidable requirement of all code. Things go wrong.
How best to reconcile these problems?
It would be nice to have an environment that hides and shows code in terms of the path of execution. So you'd have a happy path view, views for each alternative path, a view for the malloc fail path and so on.
No idea how that could be done. Sounds dangerously like generated code; or alternatively a self-contained image environment à la Smalltalk/Lisp.