Common Lisp the Language, 2nd Edition

Next: Restart Functions Up: Program Interface to Previous: Finding and Manipulating

## 29.4.9. Warnings

Warnings are a subclass of errors that are conventionally regarded as ``mild.''

[Function]
`warn datum &rest arguments`

[This supersedes the description of `warn` given in section 24.1.-GLS]

Warns about a situation, by signaling a condition of type `warning`.

If datum is a condition, then that condition is used directly. In this case, if the condition is not of type `warning` or arguments is non-`nil`, an error of type `type-error` is signaled.

If datum is a condition type (a class or class name), then the condition used is effectively the result of `(apply #'make-condition datum arguments)`. This result must be of type `warning` or an error of type `type-error` is signaled.

If datum is a string, then the condition used is effectively the result of

    (make-condition 'simple-error
                    :format-string datum
                    :format-arguments arguments)

The precise mechanism for warning is as follows.

1. The warning condition is signaled.

   While the `warning` condition is being signaled, the `muffle-warning` restart is established for use by a handler to bypass further action by `warn` (that is, to cause `warn` to immediately return `nil`).

   As part of the signaling process, if `(typep condition *break-on-signals*)` is true, then a `break` will occur prior to beginning the signaling process.

2. If no handlers for the warning condition are found, or if all such handlers decline, then the condition will be reported to `*error-output*` by the `warn` function (with possible implementation-specific extra output such as motion to a fresh line before or after the display of the warning, or supplying some introductory text mentioning the name of the function that called `warn` or the fact that this is a warning).

3. The value returned by `warn` (if it returns) is `nil`.

Next: Restart Functions Up: Program Interface to Previous: Finding and Manipulating