[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] s11n and tinyclos
From: |
Shawn Rutledge |
Subject: |
Re: [Chicken-users] s11n and tinyclos |
Date: |
Thu, 23 Oct 2008 23:43:51 -0700 |
On Wed, Mar 8, 2006 at 8:04 PM, Kon Lovett <address@hidden> wrote:
> On Mar 7, 2006, at 10:27 PM, felix winkelmann wrote:
>
>> On 3/2/06, Simon St-Onge <address@hidden> wrote:
>>>
>>> Hi,
>>>
>>> I am trying to serialize/deserialize a tinyclos object using s11n:
>>>
>>
>> Hi, Simon!
>>
>> Well, looking at the dumped instance with chicken-dump appears
>> to show something sensible, but the problem lies deeper: TinyCLOS
>> instances contain direct references to their class, which gets serialized
>> with the intance itself. But on deserialization, the class loses its
>> identity,
>> and therefore the whole class-hierarchy of a deserialized instance
>> is invalid (we have several <class> or <top> classes in the end).
>> TinyCLOS has no notion of a global class table, which could be used
>> to map deserialized classes back to their "canonical" (i.e. system-wide)
>> identity.
>> So the bottom line is (currently) that instances (and thus classes) can
>> not
>> be reliably deserialized.
>
> Or anything that has a global identity, beyond built-in. Need some kind of
> '(remain <object>)' to designate existing "root" objects, i.e. objects that
> will exist when the de-serialization occurs. How to handle the "root"
> dependency is unspecified.
That was a long time ago... now I just found myself wanting to try
this too. The behavior is different:
#;1> (use s11n)
; loading /usr/lib64/chicken/3/s11n.so ...
#;2> (use tinyclos)
; loading /usr/lib64/chicken/3/tinyclos.scm ...
; loading /usr/lib64/chicken/3/tinyclos-base.so ...
#;3> (define-class <thing> () (element))
#;4> (define-method (initialize (thing <thing>) (element <top>))
(slot-set! thing 'element element))
#;5> (let ((port (open-output-file "~/thing.txt"))
(thing (make <thing> "allo")))
(serialize thing port)
(close-output-port port))
Error: (serialize) unable to serialize object - unable to serialize
procedure (no table entry found): #<procedure (f_5740)>
Call history:
<syntax> (serialize thing port)
<syntax> (close-output-port port)
<syntax> (open-output-file "~/thing.txt")
<syntax> (make <thing> "allo")
<eval> (open-output-file "~/thing.txt")
<eval> (make <thing> "allo")
<eval> [initialize] (slot-set! thing (quote element) element)
<eval> (serialize thing port) <--
#;5> #<procedure (f_5740)>
Error: unreadable object
...
#;5> #<procedure C_greaterp>
which looks like a foreign function I guess.
- Re: [Chicken-users] s11n and tinyclos,
Shawn Rutledge <=