[gambit-list] problem with serialization/deserialization of structures

Alexey Voinov voins at voins.program.ru
Mon Nov 27 15:45:03 EST 2006


Hello.

A friend of mine recently discovered strange behavior in gambit
interpreter:

$ gsi
Gambit Version 4.0 beta 20

> (define-structure foo x y)
> (define a (make-foo 11 22))
> a
#<foo #2 x: 11 y: 22>
> (foo? a)
#t
> (define b (u8vector->object (object->u8vector a)))
> b
#<foo #3 x: 11 y: 22>
> (foo? b)
#f
> (define c (u8vector->object (object->u8vector a)))  
> c
#<foo #4 x: 11 y: 22>
> (foo? c)
#f
> (##vector-ref a 0)
#<type #5 foo>
> (##vector-ref b 0) 
#<type #6 foo>
> (##vector-ref c 0)
#<type #7 foo>
> 

Note, now we have three different types named foo, but can do anything
useful only with one of them.

-- 
Alexey Voinov



More information about the Gambit-list mailing list