From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id JAA21382; Tue, 9 Jul 2002 09:57:00 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id JAA31671 for ; Tue, 9 Jul 2002 09:56:59 +0200 (MET DST) Received: from mel-rto3.wanadoo.fr (smtp-out-3.wanadoo.fr [193.252.19.233]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id g697uwr26154 for ; Tue, 9 Jul 2002 09:56:58 +0200 (MET DST) Received: from mel-rta10.wanadoo.fr (193.252.19.193) by mel-rto3.wanadoo.fr (6.5.007) id 3D1848E6007CFE74; Tue, 9 Jul 2002 09:56:57 +0200 Received: from warp (217.128.142.232) by mel-rta10.wanadoo.fr (6.5.007) id 3D2A79160000E04A; Tue, 9 Jul 2002 09:56:57 +0200 Message-ID: <001701c2271e$1609ac30$d100a8c0@warp> From: "Nicolas Cannasse" To: "Oleg" , "OCaml" References: <200207081952.PAA28813@hickory.cc.columbia.edu> <15657.61603.221054.289184@spike.artisan.com> <200207090442.AAA05638@hickory.cc.columbia.edu> Subject: Re: [Caml-list] Universal Serializer (was: productivity improvement) Date: Tue, 9 Jul 2002 09:56:08 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > 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