(hook-attach hook-id procedure)
(hook-detach hook-id &rest procedure).
Hook-attach attaches a procedure to a hook. The temporal ordering of the execution of hook-attach forms on a hook may be important, depending on the used hook combinator (discussed in the following section). Hook-detach is the opposite of hook-attach. The form (hook-detach hook-id), which is without a procedure parameter, detaches all procedures from hook-id.
We have found it useful to be able to activate the default forms of a hook construct in an attached procedure. This makes it easy to extend a pre-specialized program, rather than changing it. The following primitive is used to activate the default forms from an attached procedure:
This primitive is not defined outside procedures attached to hook-id. In Lisp dialects with static name bindings, free names in default-forms of the hook construct should be closed in the context of the hook definition.
It is assumed that the hook-attach and hook-detach forms are used in the scope of the hook definition (see section 5.1). The binding of free names in attached procedures should follow the general binding discipline of the Lisp dialect in question.