Books of Note

Practical Common
LispThe best intro to start your journey. Excellent coverage of CLOS.

ANSI Common
LispAnother great starting point with a different focus.

Paradigms of Artificial Intelligence
ProgrammingA superb set of Lisp examples. Not just for the AI crowd.

Tuesday, May 04, 2004

Learning the condition system 

Now that my basic resolver library is "out there," in the wild, it's time to start learning some parts of CL that will enhance it. In particular, I'm starting to work on the condition system. From what I can glean, this is a bit like Java's exception handling mechanism, but with some additional features that make it far more powerful. In particular, the CL condition system has the concepts of restarts. When a condition is signaled, a handler (the analog of a Java catch block) has the ability to restart the computation in one of several ways. Often, you see this capability when your program has an error and breaks into the debugger. The restarts are then offered to the user to select, but one of those choices could have been selected under program control, just as well. (In this case, it really is being selected under program control; the debugger is the handler, since your program didn't specify it's own. It's just that the debugger is a pretty dumb handler; it just displays the restarts available and lets the user choose rather than implementing more sophisticated logic to select among them itself.)

The biggest problem I'm having is that most of the books and resources I have don't provide a very thorough treatment of the condition system. Some mention it but give very cursory treatment. If you know of a resource which really handles it well, feel free to pass it along.

You can find great background on the condition system: why it is the way it is and the previous systems that had influence on it in Ken Pitman's Condition Handling in the Lisp Language Family. Unfortunately, this resource isn't a good tutorial; it describes the why of the condition system, but not so much the what.

Post a Comment

Links to this post:

Create a Link

This page is powered by Blogger. Isn't yours?