From: Xavier Leroy <Xavier.Leroy@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"
Date: Fri, 17 Oct 1997 10:59:46 +0200 (MET DST)
> 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
- Xavier Leroy
This archive was generated by hypermail 2b29 : Sun Jan 02 2000 - 11:58:12 MET