Next: , Previous: , Up: iklib unwind-protect   [Index]


6.9.8 Use with returnable bodies

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