summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArun Isaac2022-07-13 01:36:22 +0530
committerArun Isaac2022-07-13 01:40:08 +0530
commit54b82e79fb586578dadd90c5d3853909a49b3156 (patch)
tree0be2dc3282bed31a1e49f11f5ee74f2022e69f73
parent5d581599692683de83bf595d0b55c9b00cb08fb5 (diff)
downloadtissue-54b82e79fb586578dadd90c5d3853909a49b3156.tar.gz
tissue-54b82e79fb586578dadd90c5d3853909a49b3156.tar.lz
tissue-54b82e79fb586578dadd90c5d3853909a49b3156.zip
document: Tolerate unbound slots when serializing.
* tissue/document.scm (object->scm): Drop unbound slots, do not raise an error.
-rw-r--r--tissue/document.scm13
1 files changed, 6 insertions, 7 deletions
diff --git a/tissue/document.scm b/tissue/document.scm
index 52bf34f..ada72eb 100644
--- a/tissue/document.scm
+++ b/tissue/document.scm
@@ -95,13 +95,12 @@ that operates on a copy of OBJECT. It does not mutate OBJECT."
(list->vector (map object->scm object)))
(else
(cons (cons 'type (class-name (class-of object)))
- (map (lambda (slot)
- (let* ((slot-name (slot-definition-name slot))
- (value (if (slot-bound? object slot-name)
- (slot-ref object slot-name)
- (goops-error "Unbound slot ~s in ~s" slot-name object))))
- (cons slot-name (object->scm value))))
- (class-slots (class-of object)))))))
+ (filter-map (lambda (slot)
+ (if (slot-bound? object (slot-definition-name slot))
+ (cons (slot-definition-name slot)
+ (object->scm (slot-ref object (slot-definition-name slot))))
+ #f))
+ (class-slots (class-of object)))))))
(define (scm->object scm)
"Convert serializable object SCM to a GOOPS object."