next up previous
Next: Open Points Up: Hooks in Lisp Previous: Pan

Summary

  Based on this analysis of the use of hooks in a variety of Lisp environments, we find that the following characterization of hooks covers the intended meaning of hooks in most Lisp systems:
A hook is an announced, program defined activation of one or more user-supplied functions. The activations of the functions may substitute an existing fragment in the program. The activated functions are said to be attached to the hook. It is a requirement that functions can be attached at the execution time of the program. The announcement formulates opportunities of and requirements to the hook, in terms of, e.g., triggering events or conditions, expected results, and expected side effects.

There are several possible variations of the hook idea, as presented above.

  1. Hook defaults.
    It may be possible to have some default program fragment, which is executed if no function is attached to the hook. If a default can be present, one may be able to execute the default as part of the attached function.

  2. Single or multiple attachment.
    In the simple cases, only a single function may be attached to a hook, and this attachment prevents other functions from being attached to the same hook. It is, however, sometimes useful to be able to attach more than one function to a hook. This also ensures that the hook remains open independent of prior attachments. If multiple attachments are supported, the value of the hook may be determined in different ways from the collection of attached functions.

  3. Parametrization of hooks.
    The hook may have no arguments, or it may pass a number of parameter expressions to the possibly attached functions.
In section 5, where we describe a concrete elaboration of a hook mechanism for Lisp, these and other variations will be discussed in more details.



next up previous
Next: Open Points Up: Hooks in Lisp Previous: Pan



Kurt Noermark
Wed Mar 6 09:44:24 MET 1996