From f9b594c482f78dace86a1039f2955296ed538da3 Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Thu, 7 Nov 2019 15:07:14 +0100 Subject: [PATCH] Move false-if-exception down in boot-9 * module/ice-9/boot-9.scm (false-if-exception): Move down. --- module/ice-9/boot-9.scm | 47 +++++++++++++++++++++++------------------ 1 file changed, 27 insertions(+), 20 deletions(-) diff --git a/module/ice-9/boot-9.scm b/module/ice-9/boot-9.scm index 3b98aaf75..c32a307db 100644 --- a/module/ice-9/boot-9.scm +++ b/module/ice-9/boot-9.scm @@ -1067,26 +1067,6 @@ VALUE." (define call/cc call-with-current-continuation) -(define-syntax false-if-exception - (syntax-rules () - ((false-if-exception expr) - (catch #t - (lambda () expr) - (lambda args #f))) - ((false-if-exception expr #:warning template arg ...) - (catch #t - (lambda () expr) - (lambda (key . args) - (for-each (lambda (s) - (if (not (string-null? s)) - (format (current-warning-port) ";;; ~a\n" s))) - (string-split - (call-with-output-string - (lambda (port) - (format port template arg ...) - (print-exception port #f key args))) - #\newline)) - #f))))) @@ -1843,6 +1823,33 @@ written into the port is returned." file-name-separator-string) file))) + + + +;;; {Exception-handling helpers} + +(define-syntax false-if-exception + (syntax-rules () + ((false-if-exception expr) + (catch #t + (lambda () expr) + (lambda args #f))) + ((false-if-exception expr #:warning template arg ...) + (catch #t + (lambda () expr) + (lambda (key . args) + (for-each (lambda (s) + (if (not (string-null? s)) + (format (current-warning-port) ";;; ~a\n" s))) + (string-split + (call-with-output-string + (lambda (port) + (format port template arg ...) + (print-exception port #f key args))) + #\newline)) + #f))))) + + ;;; {Help for scm_shell}