Next: iklib unwind-protect coroutines, Previous: iklib unwind-protect loops, Up: iklib unwind-protect [Index]
The unwind–protection mechanism has special integration with the
returnable syntax defined by (vicare); if an
unwind–protection syntax is used in the body of returnable and
return is used in the body forms: the unwind handler is
evaluated correctly. We have to remember that return is
implemented by an escaping continuation.
#!vicare
(import (vicare))
(define y #f)
(returnable
(with-unwind-protection
(lambda (why)
(set! y #t))
(lambda ()
(return 1))))
⇒ 1
y ⇒ #t