Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0001926OCamlOCaml generalpublic2003-11-12 23:292003-11-19 14:56
Assigned To 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0001926: IO module (feature wish)
DescriptionFull_Name: Oleg Trott
Version: N/A
Submission from: (

I'm very puzzled why after over 10 years, Caml did not acquire something like
this ("Modern" languages seem to usually have it: Haskell has "read" and
"show", e.g.)

(* =========== module IO ================== *)

module type AnyType = sig type t end

type style = Binary | Caml | S_expr | XML

exception Parse_error
exception Type_error

module type S =
    type t
    val from_channel: ?style:style -> in_channel -> t
    val from_string : ?style:style -> string -> t
    val from_buffer : ?style:style -> string -> int -> t

    val to_channel: ?style:style -> ?detect_sharing:bool -> out_channel -> t
-> unit
    val to_string: ?style:style -> ?detect_sharing:bool -> t -> string
    val to_buffer: ?style:style -> ?detect_sharing:bool -> t -> string ->
int-> int

module Make (Any : AnyType) : S with type t = Any.t

(* ======================================== *)

No explanation is necessary, I hope. IO module should to be type-safe and
subsume Marshal and IOXML.

This would, of course, require compiler support, since users can not do type
introspection, even with Camlp4.

TagsNo tags attached.
Attached Files

- Relationships

-  Notes
There are no notes attached to this issue.

- Issue History
Date Modified Username Field Change
2005-11-18 10:13 administrator New Issue

Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker