guile-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Guile-commits] GNU Guile branch, master, updated. release_1-9-4-96-g672


From: Ludovic Courtès
Subject: [Guile-commits] GNU Guile branch, master, updated. release_1-9-4-96-g67231ce
Date: Tue, 10 Nov 2009 21:19:39 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Guile".

http://git.savannah.gnu.org/cgit/guile.git/commit/?id=67231cef723ace0358e4ff743c0f8656eac48001

The branch, master has been updated
       via  67231cef723ace0358e4ff743c0f8656eac48001 (commit)
      from  99480e111815593c6828eb6081baece0f41d8233 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 67231cef723ace0358e4ff743c0f8656eac48001
Author: Ludovic Courtès <address@hidden>
Date:   Tue Nov 10 22:15:21 2009 +0100

    Improve the printer of SRFI-35 error conditions.
    
    * module/srfi/srfi-35.scm (print-condition): Print the name and value of
      each field.

-----------------------------------------------------------------------

Summary of changes:
 module/srfi/srfi-35.scm |   19 ++++++++++++++++---
 1 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/module/srfi/srfi-35.scm b/module/srfi/srfi-35.scm
index 12aa83a..7407feb 100644
--- a/module/srfi/srfi-35.scm
+++ b/module/srfi/srfi-35.scm
@@ -100,9 +100,22 @@
              (cons "pr" layout)))))
 
 (define (print-condition c port)
-  (format port "#<condition ~a ~a>"
-         (condition-type-id (condition-type c))
-         (number->string (object-address c) 16)))
+  ;; Print condition C to PORT in a way similar to how records print:
+  ;; #<condition TYPE [FIELD: VALUE ...] ADDRESS>.
+  (define (field-values)
+    (let* ((type    (struct-vtable c))
+           (strings (fold (lambda (field result)
+                            (cons (format #f "~A: ~S" field
+                                          (condition-ref c field))
+                                  result))
+                          '()
+                          (condition-type-all-fields type))))
+      (string-join (reverse strings) " ")))
+
+  (format port "#<condition ~a [~a] ~a>"
+          (condition-type-id (condition-type c))
+          (field-values)
+          (number->string (object-address c) 16)))
 
 (define (make-condition-type id parent field-names)
   "Return a new condition type named ID, inheriting from PARENT, and with the


hooks/post-receive
-- 
GNU Guile




reply via email to

[Prev in Thread] Current Thread [Next in Thread]