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 KAA19959; Sun, 25 Apr 2004 10:56:30 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id KAA19979 for ; Sun, 25 Apr 2004 10:56:29 +0200 (MET DST) Received: from smtp.mbg.ocn.ne.jp (mbg.ocn.ne.jp [210.190.142.181]) by nez-perce.inria.fr (8.12.10/8.12.10) with ESMTP id i3P8uSjq027958 for ; Sun, 25 Apr 2004 10:56:28 +0200 Received: from localhost (p25079-adsau14honb7-acca.tokyo.ocn.ne.jp [220.111.75.79]) by smtp.mbg.ocn.ne.jp (Postfix) with ESMTP id 162456426 for ; Sun, 25 Apr 2004 17:56:27 +0900 (JST) Date: Sun, 25 Apr 2004 17:56:23 +0900 (JST) Message-Id: <20040425.175623.71081314.yoriyuki@mbg.ocn.ne.jp> To: caml-list@inria.fr Subject: Common IO structure (was Re: [Caml-list] [ANN] The Missing Library) From: Yamagata Yoriyuki In-Reply-To: <007501c429de$7aee90b0$19b0e152@warp> References: <007501c429de$7aee90b0$19b0e152@warp> X-Mailer: Mew version 3.3 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Miltered: at nez-perce by Joe's j-chkmail ("http://j-chkmail.ensmp.fr")! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 yamagata:01 yoriyuki:01 yoriyuki:01 cannasse:01 warplayer:01 caml-list:01 2004:99 extlib:01 high-level:01 ocamlnet:01 camomile:01 extlib:01 contender:01 camomile:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk From: "Nicolas Cannasse" Subject: Re: [Caml-list] [ANN] The Missing Library Date: Sat, 24 Apr 2004 11:28:19 +0200 > There is a beginning of answer in the ExtLib : it's the new IO module that > is enabling high-level abstracts inputs/ouputs. http://ocaml-lib.sf.net as > usual :-) While we are at it... Several libraries (Cryptokit, ocamlnet, and Camomile, as far as I know) have their own I/O modules. Could we unify these interfaces? IO module of SF Extlib might be a contender, but its channels are abstract types, which I think problematic. >>From Camomile perspective, I want channels 1) Polymorphic, so that channels can handle Unicode characters directly. 2) Based on Objects, so that each library can make an extension of channels while remain compatible with the common interface. 3) Light weight. Using objects has the extra plus that what we really have to in this case is only using the same method name. We do not need to introduce a dependency to the common I/O library. Just for the reference, I put Camomile OOChannel interface in the last. I'd like to hear the opinion of library developpers. (** Generic input/output channel *) class type ['a] obj_input_channel = object method close : unit (** If the channel is already terminated, raise End_of_file *) method get : 'a end class type ['a] obj_output_channel = object method close : unit method flush : unit method put : 'a -> unit end class ['a] channel_of_stream : 'a Stream.t -> ['a] obj_input_channel val stream_of_channel : 'a #obj_input_channel -> 'a Stream.t class ['a, 'b] filter_in : ('b obj_output_channel -> 'a obj_output_channel) -> 'a obj_input_channel -> ['b] obj_input_channel class ['a] unget : 'a #obj_input_channel -> object inherit ['a] obj_input_channel method unget : 'a -> unit end class type char_input_channel = object inherit [char] obj_input_channel method input : string -> int -> int -> int method really_input : string -> int -> int -> unit end class type char_output_channel = object inherit [char] obj_output_channel method output : string -> int -> int -> unit end class char_input_channel_of : char obj_input_channel -> char_input_channel class char_output_channel_of : char obj_output_channel -> char_output_channel class of_in_channel : Pervasives.in_channel -> char_input_channel class of_out_channel : Pervasives.out_channel -> char_output_channel ------------------- 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