[
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: | Xavier Leroy <Xavier.Leroy@i...> |
| Subject: | Re: 'a -> string ? |
> 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