Next: iklib unwind-protect dynamic, Previous: iklib unwind-protect intro, Up: iklib unwind-protect [Index]
These two syntaxes are aliases. Call ?thunk and then, when the
dynamic extent of the call terminates, call the procedure
?unwind-handler. When ?thunk performs a normal return: the
return values of ?thunk become the return values of
with-unwind-handler
.
When called: ?unwind-handler is applied to a Scheme symbol
representing the cause of the call: ‘return’, ‘escape’,
‘exception’. The argument ?unwind-handler comes before the
argument ?thunk for uniformity with with-exception-handler
,
with-exception-handler.
Notice that a function tail–call in ?thunk is not a
tail–call for with-unwind-protection
.
Simple wrapper for with-unwind-protection
that provides a
syntax similar to that of Common Lisp’s macro. It is expanded to:
(with-unwind-protection (lambda (dummy) ?cleanup0 ?cleanup ...) (lambda () ?body))