From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id RAA28689; Wed, 12 Nov 2003 17:35:25 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f 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 RAA28772 for ; Wed, 12 Nov 2003 17:35:24 +0100 (MET) Received: from jalapeno.cc.columbia.edu (jalapeno.cc.columbia.edu [128.59.59.238]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id hACGZN119422 for ; Wed, 12 Nov 2003 17:35:23 +0100 (MET) Received: from tw304h3.cpmc.columbia.edu (tw304h3.cpmc.columbia.edu [156.111.84.180]) (user=ot14 mech=LOGIN bits=0) by jalapeno.cc.columbia.edu (8.12.10/8.12.10) with ESMTP id hACGZKBU025734 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NOT) for ; Wed, 12 Nov 2003 11:35:20 -0500 (EST) From: Oleg Trott To: caml-list@inria.fr Subject: [Caml-list] Big feature wish: IO module Date: Wed, 12 Nov 2003 11:35:02 -0500 User-Agent: KMail/1.5.4 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200311121135.02082.oleg_trott@columbia.edu> X-No-Spam-Score: Local X-Scanned-By: MIMEDefang 2.35 X-Loop: caml-list@inria.fr X-Spam: no; 0.00; oleg:01 oleg:01 haskell:01 expr:01 val:01 val:01 buffer:01 buffer:01 int-:01 type-safe:01 subsume:01 ioxml:01 camlp:01 camlp:01 compiler:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk 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 ------------------- 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