Browse thread
[Caml-list] productivity improvement
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| 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" and > "read" methods defined, then in theory, a hypothetical compiler ought to be > able to generate such serialization functions automatically (IIRC Lisp and > Scheme do this because of the simplicity of their type systems, but I may be > 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 caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners