Thanks, Andy, for your reply -- with your patch, save-objects now completes.
However, it still appears not to create output with enough information
to re-create the objects. If I do this...:
$ cat persistence-test.scm
(use-modules (oop goops))
(use-modules (oop goops describe))
(use-modules (oop goops save))
;; Apply Andy's fix to the readable? function
(set! (@@ (oop goops save) readable?)
(lambda (x) (hashq-ref (@@ (oop goops save) readables) x)))
;; make a new class, make an instance of it, and show it
(define-class <ag-complex> (<number>) r i)
(define c (make <ag-complex>))
(slot-set! c 'r 3)
(slot-set! c 'i 4)
(describe c)
;; persist the instance
(define a '())
(set! a (acons 'c c a))
(save-objects a (current-output-port))
$ guile ./persistence-test.scm
;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0
;;; or pass the --no-auto-compile argument to disable.
;;; compiling /home/apg/t/./persistence-test.scm
;;; compiled /home/apg/.cache/guile/ccache/2.0-LE-4-2.0/home/apg/t/persistence-test.scm.go
#<<ag-complex> 932ace0> is an instance of class <ag-complex>
Slots are:
r = 3
i = 4
(define c '#<<ag-complex> 932ace0>)
... then that last line, which is the output of save-objects, doesn't look sufficient
(to my untrained eye, at any rate) to re-create the object in a freshly-launched
guile in a new address space. I'd expect it to contain the values for the slots
as shown in the output from 'describe', as well as the class definition.
My assumptions derive from these comments in oop/goops/save.scm:
;;; Save OBJECT ... to PORT so that when the data is read and evaluated
;;; OBJECT ... are re-created under names NAME ... .