location2.scm 460 B

123456789101112131415161718
  1. (define (test-location-local x a)
  2. (let* ((xl (try-catch (if a
  3. (location x)
  4. (throw (java.lang.Exception)))
  5. (ex java.lang.Throwable
  6. (throw ex))))
  7. (z (xl))
  8. (zl (location z)))
  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.