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
[Caml-list] productivity improvement
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2002-07-09 (07:57)
From: Nicolas Cannasse <warplayer@f...>
Subject: Re: [Caml-list] Universal Serializer (was: productivity improvement)
> AFAICT if a data structure is created using combinations of unions, lists,
> arrays, etc. of built-in types or objects that, e.g. already have "write"
> "read" methods defined,  then in theory, a hypothetical compiler ought to
> able to generate such serialization functions automatically (IIRC Lisp and
> Scheme do this because of the simplicity of their type systems, but I may
> wrong here).
> Does O'Caml allow any type of short-cuts to avoid coding serialization
> manually?

Of course !
You can use either the Marshal module or the input_value / output_value to
read / write any data structures composed of basic ocaml types ( including
complexes & recursives structures - list arrays etc.).
Note that actually the marshaling process is unsafe ( your program can crash
if you're not reading the same type that you've written ). If you're using
native C data embedded into OCaml type, you can write your own (de)serialize
functions in C by using custom blocks.

PS : Object serialization is not available.

Nicolas Cannasse

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: