Hooks extension point mechanism (as in Emacs) for Common Lisp
A hook, in the present context, is a certain kind of extension point in a program that allows interleaving the execution of arbitrary code with the execution of a the program without introducing any coupling between the two. Hooks are used extensively in the extensible editor Emacs.
In the Common LISP Object System (CLOS), a similar kind of extensibility is possible using the flexible multi-method dispatch mechanism. It may even seem that the concept of hooks does not provide any benefits over the possibilities of CLOS. However, there are some differences:
There can be only one method for each combination of specializers and qualifiers. As a result this kind of extension point cannot be used by multiple extensions independently.
Removing code previously attached via a
:around method can be cumbersome.
There could be other or even multiple extension points besides
:after in a single method.
Attaching codes to individual objects using eql specializers can be cumbersome.
Introspection of code attached a particular extension point is cumbersome since this requires enumerating and inspecting the methods of a generic function.
This library tries to complement some of these weaknesses of method-based extension-points via the concept of hooks.
|No lint warnings ✓|