Book Review – The Common Lisp Condition System: Beyond Exception Handling with Control Flow Mechanisms.

Written by on November 8, 2020 in Book Review, LISP, Programming with 0 Comments

Title: The Common Lisp Condition System: Beyond Exception Handling with Control Flow Mechanisms

Author: Michał “phoe” Herda

Publisher: Apress

Year: 2020

Unlike with other languages, it is rare to find new books being published on Lisp. The last book on Lisp, which I purchased was “Common Lisp Recipes”  by Edmund Weitz in March 2016. After a huge gap of over 4 years, there is this new book by Michał “phoe” Herda and I got it last week. What better way to enjoy the Holiday season than spending quality time reading a good Lisp book!

As the title says, this book is about Common Lisp’s Condition System. I am comfortable programming in Lisp and the Condition System is not new to me. So when I ordered the book, I was thinking “What is this fuss about? What is there in the Condition System that warrants an entire book?” 

I am really glad I got the book! It is packed with so much insight and information that every Lisp programmer will learn something new from it. Honestly, I did.

The Condition System in Common Lisp is loosely similar to the exception handling mechanisms in languages such as C++ and Java, but is much more expressive, elegant and powerful. Reading this book will definitely reinforce this point.

Chapter 1 covers the necessary low-level concepts that are required to understand the Condition System. This chapter is a must-read for people coming from other programming languages. The author starts with  a simple C program and gradually builds up the notions of “Dynamic Variables”, “Lexical Closure” and shows how these ideas are important in the context of non-local transfer of control.

Chapter 2 introduces the Condition System. This is the lengthiest chapter in the book. The author  first describes several examples of a “hook”-based approach for extending system behaviour and then introduces condition handlers in a carefully graded manner. All the examples are well chosen and expose the nuances of the exception handling mechanism. This chapter also highlights another unique feature of the Lisp language, where the Debugger gets control when other things fail, allowing the programmer to interactively choose an appropriate Restart. A beginner might feel intimidated by the amount of detail in this chapter, but I feel it is unavoidable. 

Chapter 3, in my opinion, is the most engaging part in the book. Here, the author describes the complete implementation of a “Portable Condition System” that conforms to the ANSI Standard, and the source code is available for download and further study. 

Chapter 4, provides a logical conclusion to the concepts discussed in the earlier chapters. Here, the author discusses some philosophical issues and possible downsides of the Condition System. Towards the end, he touches upon a few interesting use cases of the Condition System beyond exception handling, including a Testing library, a Web framework, and a Python-like generator.  

Chapter 5, the final chapter, is a collection of reference material organised in the form of Appendixes. One of them is an overview of Lisp macros. This is a useful addition because a lot of interesting Lisp code uses macros. 

Appendix E contains some additional material that did not make into the book and Appendix F contains errata. These are available online. (Thanks to the author for bringing this to my attention.)

Every Lisp programmer must read this book, and if necessary, multiple times. I will even go further and appeal to designers and developers of other programming languages to go through the book as well. 

Of course, Lisp is such an adorable language. There is a lot that one can learn (and continue to learn)  from it!

Have a nice weekend and a great week ahead!


Tags: , ,


If you enjoyed this article, subscribe now to receive more just like it.

Subscribe via RSS Feed

Leave a Reply

Your email address will not be published. Required fields are marked *