Next: , Previous: Traps Installing More Traps, Up: Traps Common Trap Options

When creating any kind of trap object, settings for the trap being created are specified as options on the make call using syntax like this:

     (make <trap-class>
       #:option-keyword setting

The following common options are provided by the base class <trap>, and so can be specified for any kind of trap.

— Class: <trap>

Base class for trap objects.

— Trap Option: #:condition thunk

If not #f, this is a thunk which is called when the trap fires, to determine whether trap processing should proceed any further. If the thunk returns #f, the trap is basically suppressed. Otherwise processing continues normally. (Default value #f.)

— Trap Option: #:skip-count count

A count of valid (after #:condition processing) firings of this trap to skip. (Default value 0.)

— Trap Option: #:single-shot boolean

If not #f, this indicates that the trap should be automatically uninstalled after it has successfully fired (after #:condition and #:skip-count processing) for the first time. (Default value #f.)

— Trap Option: #:behaviour behaviour-proc

A trap behaviour procedure — as discussed in the preceding subsubsection — or a list of such procedures, in which case each procedure is called in turn when the trap fires. (Default value '().)

— Trap Option: #:repeat-identical-behaviour boolean

Normally, if multiple trap objects are triggered by the same low level trap, and they request the same behaviour, it's only actually useful to do that behaviour once (per low level trap); so by default multiple requests for the same behaviour are coalesced. If this option is set other than #f, the contents of the #:behaviour option are uniquified so that they avoid being coalesced in this way. (Default value #f.)