[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 02/07: Move false-if-exception down in boot-9
From: |
Andy Wingo |
Subject: |
[Guile-commits] 02/07: Move false-if-exception down in boot-9 |
Date: |
Fri, 8 Nov 2019 09:31:53 -0500 (EST) |
wingo pushed a commit to branch wip-exceptions
in repository guile.
commit f9b594c482f78dace86a1039f2955296ed538da3
Author: Andy Wingo <address@hidden>
Date: Thu Nov 7 15:07:14 2019 +0100
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 3b98aaf..c32a307 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}
- [Guile-commits] branch wip-exceptions updated (b3b359d -> b31c94d), Andy Wingo, 2019/11/08
- [Guile-commits] 02/07: Move false-if-exception down in boot-9,
Andy Wingo <=
- [Guile-commits] 05/07: Move exceptions with key and args to core, Andy Wingo, 2019/11/08
- [Guile-commits] 01/07: Move adapter between "throw" and "raise" exceptions into core, Andy Wingo, 2019/11/08
- [Guile-commits] 04/07: Move the core of exception objects into core, Andy Wingo, 2019/11/08
- [Guile-commits] 03/07: Move exception-handling routines after records in boot-9, Andy Wingo, 2019/11/08
- [Guile-commits] 07/07: rebase throw/catch on top of raise-exception/with-exception-handler, Andy Wingo, 2019/11/08
- [Guile-commits] 06/07: Remove boot "catch" definition., Andy Wingo, 2019/11/08