Find Related products on Amazon

Shop on Amazon

Depending in Common Lisp – Using the CLOS dependent maintenance protocol (2022)

Published on: 2025-07-05 10:42:51

A while ago I was working on a Common Lisp library that makes use of the Metaobject Protocol. I ran into a few edge cases around dependencies between classes and it took a while for me to figure out how to solve them, so I wanted to write down what I learned in case anyone else might find it useful. This post is an expanded version of a Reddit thread I posted. Before we can see the problem, we need a simple example. We'll use the monitored-class metaclass from The Art of the Metaobject Protocol (pages 96-97). Using this class as a metaclass will log all slot reads and writes, which could be useful for auditing access to certain objects. Before we get started we'll need Closer to MOP as an implementation compatibility layer: ( ql:quickload :closer-mop ) First we define the metaclass: ( defclass monitored-class ( standard-class ) ( ) ) Next we'll explicitly say that it's okay for a monitored class to have superclasses that are standard classes: ( defmethod c2mop:validate-superclas ... Read full article.