- Author
- The Common Lisp Cookbook Project, based on an article by z0ltan
- Published
- Undated
- Kind
- Community cookbook recipe with REPL examples
- Original
- lispcookbook.github.io/cl-cookbook/error_handling.html
- Subject
- Programming languages and types
What it is
The Common Lisp Cookbook Project maintains this recipe. The page says it is heavily based on an article by z0ltan. It explains how to handle, define and signal conditions in Common Lisp. It ends with a list of further resources.
What it says
- A condition in Common Lisp can stand for any situation needing branching, not only errors.
- Conditions are signaled and handled, and handling does not unwind the stack by itself.
- The macro handler-case unwinds the stack, while handler-bind keeps every frame visible.
- Restarts, set up with restart-case, are named recovery choices offered in the debugger.
- Handlers can pick a restart in code with invoke-restart, so recovery needs no human.
- The unwind-protect form plays the part of finally, and with-open-file is built on it.
- The signal function raises a condition without printing or entering the debugger.
What evidence it gives
The recipe shows code with REPL output from a Slime session. It includes a backtrace comparison and the source of with-open-file. It offers no benchmarks or user studies.
Interests and limits
It is a community-written tutorial, and the page is undated. Most examples assume SBCL and Slime. One example uses the zenity tool on GNU/Linux. The page promotes the main contributor's video course.