[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Persisting GOOPS objects
From: |
Andy Wingo |
Subject: |
Re: Persisting GOOPS objects |
Date: |
Tue, 22 Jan 2013 10:47:24 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux) |
On Mon 21 Jan 2013 13:48, Andrew Gaylard <address@hidden> writes:
> ;; make a new class, make an instance of it, and show it
> (define-class <ag-complex> (<number>) r i)
I did a ,trace (save-objects a (current-output-port)), and it shows:
(enumerate-component! #<<ag-complex> 16b9a20> #<<environment> 1d51770>)
| (#<procedure 1a6c600 at oop/goops/dispatch.scm:204:4 args>
#<<ag-complex> 16b9a20>)
| (cache-dispatch #<<generic> immediate? (7)> (#<<ag-complex> 16b9a20>))
| [...]
| (#<procedure 14dbca0 at oop/goops/save.scm:92:0 (o)> #<<ag-complex>
16b9a20>)
| #t
Which means that (immediate? c) ended up dispatching to the procedure on
line 92 of save.scm, which is:
(define-method (immediate? (o <number>)) #t)
Which returns true because your <ag-complex> is a <number>.
So there seems to be an assumption somewhere that numbers are readable
and writable as-is. It might suffice to define an (immediate? (o
<ag-complex>)) method. Dunno, I've never worked with this code
before... Test cases and documentation are welcome :)
Andy
--
http://wingolog.org/