Next: , Previous: Location Traps, Up: Traps


5.21.3.17 Trap Shorthands

If the code described in the preceding subsubsections for creating and manipulating traps seems a little long-winded, it is of course possible to define more convenient shorthand forms for typical usage patterns. Here are some examples.

     (define (break! proc)
       (install-trap (make <procedure-trap>
                       #:procedure proc
                       #:behaviour gds-debug-trap)))
     
     (define (trace! proc)
       (install-trap (make <procedure-trap>
                       #:procedure proc
                       #:behaviour (list trace-trap
                                         trace-at-exit))))
     
     (define (trace-subtree! proc)
       (install-trap (make <procedure-trap>
                       #:procedure proc
                       #:behaviour (list trace-trap
                                         trace-until-exit))))

Definitions like these are not provided out-of-the-box by Guile, because different users will have different ideas about what their default debugger should be, or, for example, which of the common trap options (see Common Trap Options) it might be useful to expose through such shorthand procedures.