From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id OAA02930 for caml-redistribution; Fri, 17 Oct 1997 14:16:17 +0200 (MET DST) 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 LAA29294 for ; Fri, 17 Oct 1997 11:00:16 +0200 (MET DST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.8.7/8.8.5) with ESMTP id KAA23657; Fri, 17 Oct 1997 10:59:48 +0200 (MET DST) Received: (from xleroy@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id KAA29280; Fri, 17 Oct 1997 10:59:47 +0200 (MET DST) From: Xavier Leroy Message-Id: <199710170859.KAA29280@pauillac.inria.fr> Subject: Re: 'a -> string ? In-Reply-To: <199710161019.MAA04691@cosmos.imag.fr> from "GillesDfnx@mail.dotcom.fr" at "Oct 16, 97 12:19:19 pm" To: GillesDfnx@mail.dotcom.fr Date: Fri, 17 Oct 1997 10:59:46 +0200 (MET DST) Cc: caml-list@inria.fr MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: weis > I'm looking for an equivalent of > > val output_value : out_channel -> 'a -> unit > > that would output the representation of the element of type 'a into a > 'string' instead of and 'out_channel' (for subsequent inclusion into a > dbm database). I would like to avoid using a temp file followed by an > 'input' call. In the current release (OCaml 1.05), you can do that using undocumented features, as follows: let output_value_to_string v = Obj.marshal(Obj.repr v) The forthcoming release 1.06 will provide a nicer interface for this feature. Regards, - Xavier Leroy