Next Previous Up Top Contents Index

2.6 The COMMON-EXTENSIONS module

last-handler-definer

Definition macro

Summary

Defines a "last-handler" to be used after any dynamic handlers and before calling default-handler.

Definition

define last-handler (condition, #key test, init-args) 
  = handler;
define last-handler condition = handler;
define last-handler;

Arguments

condition
A Dylan expressionbnf. The class of condition for which the handler should be invoked.

test
A Dylan expressionbnf. A function of one argument called on the condition to test applicability of the handler.

init-args
A Dylan expressionbnf. A sequence of initialization arguments used to make an instance of the handler's condition class.

handler
A Dylan expressionbnf. A function of two arguments, condition and next-handler, that is called on a condition which matches the handler's condition class and test function.

Values

None.

Library

common-extensions

Module

common-extensions

Description

A last-handler is a global form of the dynamic handler introduced via let handler, and is defined using an identical syntax. The last handler is treated as a globally visible dynamic handler. During signalling if a last-handler has been installed then it is the last handler tested for applicability before default-handler is invoked. If a last-handler has been installed then it is also the last handler iterated over in a call to do-handlers.

The first two defining forms are equivalent to the two alternate forms of let handler. If more than one of these first defining forms is executed then the last one executed determines the installed handler. The current last-handler can be uninstalled by using the degenerate third case of the defining form, that has no condition description or handler function.

The intention is that libraries will install last handlers to provide basic runtime error handling, taking recovery actions such as quitting the application, trying to abort the current application operation, or entering a connected debugger.

Example

The following form defines a last-handler function called default-last-handler that is invoked on conditions of class <serious-condition>:

define last-handler <serious-condition>
  = default-last-handler;

See also

one-of, page 38

win32-last-handler in the C FFI and Win32 library reference, under library win32-user and module win32-default-handler.


Common Dylan and Functional Extensions - 31 Mar 00

Next Previous Up Top Contents Index