exit1.scm 403 B

1234567891011121314151617181920
  1. ;; Test that exit calls finally-handler.
  2. (define (fun x)
  3. (try-finally
  4. (begin
  5. (format #t "before exit~%~!")
  6. (exit 0)
  7. (format #t "after exit~%~!"))
  8. (begin
  9. (format #t "in-finally~%~!")))
  10. (format #t "finish fun~%~!")
  11. (* x x))
  12. (format #t "before call fun~%~!")
  13. (fun 5)
  14. (format #t "after call fun~%~!")
  15. ;; Output: before call fun
  16. ;; Output: before exit
  17. ;; Output: in-finally