Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
Serialisation of PXP DTDs
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2008-10-24 (14:03)
From: Markus Mottl <markus.mottl@g...>
Subject: Re: [Caml-list] Re: Serialisation of PXP DTDs
On Fri, Oct 24, 2008 at 5:11 AM, Mikkel Fahnøe Jørgensen
<> wrote:
> I guess this discussion is an overkill for the problem at hand, but
> speaking of binary extensible protocols, have you looked at ASN.1? It
> is an abstraction over any number of encodings. At least one binary
> encoding has extension bits to allow future growth of object
> collections and similar.

Note that it is perfectly safe to grow sum types with bin-prot.  It
was designed that way intentionally.  It's just not safe to reorder or
remove elements.  Nobody needs to reorder elements, because it doesn't
make any operational difference in the program.  Backward
compatibility of protocols you define necessarily requires the
presence of old constructors in sum types anyway so you may not want
to remove those in any case.  There is hardly any harm from the
protocol perspective in leaving old constructors in there.

Note, too, that polymorphic variants even allow reordering with
bin-prot.  They are also generally safer, because they are always
encoded as 32bit integers, thus making it extremely unlikely to get
accidental "good" matches when reading incompatible protocols (at the
expense of space and a tiny bit of performance).

Except for human-readability, I think bin-prot should scale very well
on the other requirements of serialization protocols once it has been
ported to architectures with unusual endianness (almost all machines
are little endian nowadays so hardly anybody on this list should be


Markus Mottl