Arc Cross Reference


[procedure] protect during after

[macro] after body cleanup ...

protect executes a thunk during, then execute a thunk after, and returns the result of during. If a control goes out of protect's dynamic scope during executing during, after is also executed.

(xdef 'protect (lambda (during after)
                  (dynamic-wind (lambda () #t) during after)))

after is a convenience macro around protect.

(mac after (x . ys)
  `(protect (fn () ,x) (fn () ,@ys)))

See also scheme:dynamic-wind, scheme:unwind-protect.