+2007-09-10 Ludovic Courtès <ludo@gnu.org>
+
+ * srfi-35.scm (make-compound-condition-type): When PARENTS
+ contains only one element, return its car. This improves the
+ output of `print-condition' for non-compound conditions returned
+ by `make-compound-condition'.
+
2007-08-11 Ludovic Courtès <ludo@gnu.org>
* srfi-35.scm: New file.
;; Return a compound condition type made of the types listed in PARENTS.
;; All fields from PARENTS are kept, even same-named ones, since they are
;; needed by `extract-condition'.
- (let* ((all-fields (append-map condition-type-all-fields
- parents))
- (layout (struct-layout-for-condition all-fields)))
- (make-struct %condition-type-vtable 0
- (make-struct-layout layout) ;; layout
- print-condition ;; printer
- id
- parents ;; list of parents!
- all-fields
- all-fields)))
+ (cond ((null? parents)
+ (error "`make-compound-condition-type' passed empty parent list"
+ id))
+ ((null? (cdr parents))
+ (car parents))
+ (else
+ (let* ((all-fields (append-map condition-type-all-fields
+ parents))
+ (layout (struct-layout-for-condition all-fields)))
+ (make-struct %condition-type-vtable 0
+ (make-struct-layout layout) ;; layout
+ print-condition ;; printer
+ id
+ parents ;; list of parents!
+ all-fields
+ all-fields)))))
\f
;;;