Action-lists are a unified approach to various different mechanisms for running initializations, or "hook" functions at various points during the life of the system. They provide central gathering points for applications to trigger on system-wide events such as start-up, disk-save, and so on.
An action-list is a tagged list of data, to be executed (in some sense) in sequence whenever the circumstance identified by its tag occurs. It is expected that whatever code detects or causes the circumstance will take care of running the action-list.
An execution-function can be specified for the action-list when it is created. Otherwise, the default behavior is to treat the data of each action as a callable and apply it to any additional arguments specified at execution time. At its simplest, an action-list emulates
(map nil 'funcall)
.
Names of action-lists and action-items are general lisp objects, compared with
equalp
. This allows strings and other objects to be used as unique identifiers.
Actions can be specified to depend on other actions; when defining an action-item, you can say that it must be before or after other action-items using the
:before
and
:after
keywords. Aside from that, actions are assumed to have no dependencies, and no order of execution should be counted on for the actions in a list.
You can (and are encouraged to) specify a documentation string for action-lists or action-items.
In addition you can create action-lists that are not registered globally. This allows applications to have disembodied action lists for their own internal purposes. The other action-list functions allow an action-list to be passed in instead of a name, to accommodate this.