Re: define-serializable-cstruct with versions?

Matthew Flatt <mflatt-sDh8Nw2yj/[email protected]>
Newsgroups gmane.comp.lang.racket.user,gmane.lisp.scheme.plt
Message-ID <[email protected]>
Yes, but I think a different protocol will be needed than for
`serializable-struct`.

With

 (serializable-struct pond (depth))

it's clear that the deserializer receives a single value for the single
field (or, more generally, N values for N fields). So, it's clear how
to make a compatibility deserialization function:

 (serializable-struct/versions pond 1 (num-fish depth)
   ([0 (lambda (d) (pond 0 d))
       (lambda () ....)]))

With 

  (define-serializable-cstruct _pond ([depth _float]))

the deserializer internally deals with a byte-string representation of
non-pointer content plus a structured representation of pointer
content. We probably don't want to expose those details, and you don't
want to deal with them.

An alternative it to make the compatibility protocol work in terms of a
separate cstruct declaration:

 (define-serializable-cstruct _old-pond ([depth _float]))

 (define-serializable-cstruct _pond ([num-fish _int]
                                     [depth _float])
   #:version 1
   #:other-versions ([0 deserialize-chain:cstruct:old-pond
                        (lambda (op)
                          (make-pond 0 (old-pond-depth op)))
                        (lambda () ....)]))

That is, compatibility deserialization is based on a reference to
deserialization information for a cstruct that has the same shape as
the old version, plus converters from instances of the old shape to the
new cstruct.

Does that interface seem ok?


At Sun, 5 Jun 2016 22:04:23 +0200, Berthold Bäuml wrote:
> Would it be possible to add for the serializable cstruct 
> (define-serializable-cstruct) versioning like in 
> define-serializable-struct/versions?
> 
> Berthold
> 
> -- 
> -----------------------------------------------------------------------
> Berthold Bäuml -- Head of Autonomous Learning Robots Lab
> DLR, Robotics and Mechatronics Center (RMC)
> Münchner Str. 20, D-82234 Wessling
> Phone +49 8153 282489
> http://www.robotic.de/Berthold.Baeuml
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/[email protected]
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups "Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/[email protected]
For more options, visit https://groups.google.com/d/optout.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.