From: Oleg Trott <oleg_trott@columbia.edu>
To: caml-list@inria.fr
Subject: [Caml-list] Big feature wish: IO module
Date: Wed, 12 Nov 2003 11:35:02 -0500 [thread overview]
Message-ID: <200311121135.02082.oleg_trott@columbia.edu> (raw)
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 =
sig
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
end
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 (I remember reading some sort of
pre-announcement about adding type introspection to Camlp4. How is that
coming along?)
BTW, there is a problem with labeled arguments within module signatures,
right?
--
Oleg Trott <oleg_trott@columbia.edu>
-------------------
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
reply other threads:[~2003-11-12 16:35 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200311121135.02082.oleg_trott@columbia.edu \
--to=oleg_trott@columbia.edu \
--cc=caml-list@inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox