(catch #t
(lambda ()
- (lazy-catch #t
- (lambda ()
- (call-with-unblocked-asyncs
- (lambda ()
- (with-traps
- (lambda ()
- (first)
-
- ;; This line is needed because mark
- ;; doesn't do closures quite right.
- ;; Unreferenced locals should be
- ;; collected.
- ;;
- (set! first #f)
- (let loop ((v (thunk)))
- (loop (thunk)))
- #f)))))
-
- ;; Note that having just
- ;; `lazy-handler-dispatch' here is
- ;; connected with the mechanism that
- ;; produces a nice backtrace upon
- ;; error. If, for example, this is
- ;; replaced with (lambda args (apply
- ;; lazy-handler-dispatch args)), the
- ;; stack cutting (in save-stack)
- ;; goes wrong and ends up saving no
- ;; stack at all, so there is no
- ;; backtrace.
- lazy-handler-dispatch))
+ (call-with-unblocked-asyncs
+ (lambda ()
+ (with-traps
+ (lambda ()
+ (first)
+
+ ;; This line is needed because mark
+ ;; doesn't do closures quite right.
+ ;; Unreferenced locals should be
+ ;; collected.
+ (set! first #f)
+ (let loop ((v (thunk)))
+ (loop (thunk)))
+ #f)))))
(lambda (key . args)
(case key
(cond ((= (length args) 4)
(apply handle-system-error key args))
(else
- (apply bad-throw key args))))))))))
+ (apply bad-throw key args)))))))
+
+ ;; Note that having just `lazy-handler-dispatch'
+ ;; here is connected with the mechanism that
+ ;; produces a nice backtrace upon error. If, for
+ ;; example, this is replaced with (lambda args
+ ;; (apply lazy-handler-dispatch args)), the stack
+ ;; cutting (in save-stack) goes wrong and ends up
+ ;; saving no stack at all, so there is no
+ ;; backtrace.
+ lazy-handler-dispatch)))
+
(if next (loop next) status)))
(set! set-batch-mode?! (lambda (arg)
(cond (arg
of debugging or re-throwing of an error. If thunk throws to the
symbol @var{key}, then @var{handler} is invoked this way:\n
@example
-(handler key args ...)
+ (handler key args ...)
@end example\n
@var{key} is a symbol or #t.\n
@var{thunk} takes no arguments. If @var{thunk} returns normally, that
If the key is @code{#t}, then a throw to @emph{any} symbol will match
this call to @code{catch}."
(catch key
- (lambda ()
- (lazy-catch key
- thunk
- lazy-handler-dispatch))
- handler))
+ thunk
+ handler
+ lazy-handler-dispatch))