[Top][All Lists]

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

Re: Persisting GOOPS objects

From: Andrew Gaylard
Subject: Re: Persisting GOOPS objects
Date: Wed, 23 Jan 2013 15:46:41 +0200

I made another attempt using strings instead of numbers, to get an idea of whether save.scm is usable:

$ 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-record> (<object>) name addr)
(define r (make <ag-record>))
(slot-set! r 'name "Fred")
(slot-set! r 'addr "101 Elm Street")
(describe r)

;; persist the instance
(define a '())
(set! a (acons 'r r a))
(save-objects a (current-output-port))

$ guile
scheme@(guile-user)> (load "persistence-test.scm")
#<<ag-record> 9f2b2a0> is an instance of class <ag-record>
Slots are:
     name = "Fred"
     addr = "101 Elm Street"
(define r (restore <ag-record> (name addr) oop/goops/save.scm:423:32: In procedure #<procedure 9f64f48 at oop/goops/save.scm:414:21 (name aname get set)>:
oop/goops/save.scm:423:32: Wrong type to apply: #<syntax-transformer write-component>

... So I guess the answer is, "not yet".

Many thanks for your help,
- Andrew

reply via email to

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