location3.scm 460 B

123456789101112131415161718
  1. (define (test-location-local x a)
  2. (let* ((xl (location x))
  3. (z (xl))
  4. (zl (try-catch (if a
  5. (location z)
  6. (throw (java.lang.Exception)))
  7. (ex java.lang.Throwable
  8. (throw ex)))))
  9. (set! (xl) (+ (zl) 100))
  10. x))
  11. (format #t "~a~%" (test-location-local 10 0))
  12. ;; Output: 110
  13. (try-catch
  14. (format #t "~a~%" (test-location-local 12 #f))
  15. (ex java.lang.Throwable
  16. (format #t "Caught ~a.~%" ex)))
  17. ;; Output: Caught java.lang.Exception.