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-23 (22:21)
From: Dario Teixeira <darioteixeira@y...>
Subject: Re: [Caml-list] Re: Serialisation of PXP DTDs

> This protocol definition is fed to the compiler, which
> generates the OCaml type definitions, as well as the 
> encoders/decoders and pretty-printers (as you can see,
> the specification uses a mix of OCaml, Haskell and C++
> syntax, but it's pretty clear IMO)

Basically the XDR approach, but with a syntax inspired
by more modern, functional languages, right?

> It's not a drop-in solution like sexplib's "with sexp",
> by design (since it is meant to allow interoperability between
> different languages), but it's still fairly easy to use.

Personally, I think that a sexplib-like syntax extension
is the killer feature for serialisation libraries, and the
reason why I was immediately swayed by sexplib.  However,
writing a sexplib-like syntax extension for your serialisation
library would entail solving the reverse problem now handled
by your compiler.  This might not always be possible because
some features of Ocaml's type system might not map neatly
into your format.  Nevertheless, the sheer convenience of
the syntax extension approach makes it worth while having,
even if on occasion the preprocessor were to produce an
error message stating that it could not convert a certain
structure.  For reference purposes, you could even have the
syntax extension output to an external file the inferred
structure definition in your language format!  (I know this
would be a very complex project, but it does illustrate the
power of Camlp4).

Anyway, what you described looks very interesting.
Keep us posted!

Dario Teixeira