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 XAA18281; Tue, 27 Apr 2004 23:51:52 +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 XAA18270 for ; Tue, 27 Apr 2004 23:51:51 +0200 (MET DST) Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.185]) by nez-perce.inria.fr (8.12.10/8.12.10) with ESMTP id i3RLpnjq005495 for ; Tue, 27 Apr 2004 23:51:50 +0200 Received: from [212.227.126.160] (helo=mrelayng.kundenserver.de) by moutng.kundenserver.de with esmtp (Exim 3.35 #1) id 1BIaUX-0000ia-00; Tue, 27 Apr 2004 23:51:49 +0200 Received: from [80.129.104.25] (helo=gate.gerd-stolpmann.de) by mrelayng.kundenserver.de with asmtp (Exim 3.35 #1) id 1BIaUX-0006MW-00; Tue, 27 Apr 2004 23:51:49 +0200 Received: from ice.gerd-stolpmann.de (ice.gerd-stolpmann.de [192.168.0.13]) by gate.gerd-stolpmann.de (Postfix) with ESMTP id D546B5816; Tue, 27 Apr 2004 23:51:48 +0200 (CEST) Received: by ice.gerd-stolpmann.de (Postfix, from userid 1000) id C5E83B032; Tue, 27 Apr 2004 23:51:47 +0200 (CEST) Subject: Re: [Caml-list] Re: Common IO structure From: Gerd Stolpmann To: Yamagata Yoriyuki Cc: caml-list@inria.fr In-Reply-To: <20040428.010033.85418284.yoriyuki@mbg.ocn.ne.jp> References: <20040427.002643.78700697.yoriyuki@mbg.ocn.ne.jp> <016401c42bc4$b6438840$19b0e152@warp> <1083013017.8842.327.camel@ice.gerd-stolpmann.de> <20040428.010033.85418284.yoriyuki@mbg.ocn.ne.jp> Content-Type: text/plain Content-Transfer-Encoding: 7bit Message-Id: <1083102706.23570.59.camel@ice.gerd-stolpmann.de> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.5 Date: Tue, 27 Apr 2004 23:51:47 +0200 X-Provags-ID: kundenserver.de abuse@kundenserver.de auth:a6865a839c0178d9aa0ce41878507ea2 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 gerd:01 stolpmann:01 2004:99 00,:99 yamagata:01 yoriyuki:01 gerd:01 stolpmann:01 caml-list:01 2004:99 ocamlnet:01 char:01 camomile:01 char:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Die, 2004-04-27 at 18:00, Yamagata Yoriyuki wrote: > From: Gerd Stolpmann > Subject: Re: [Caml-list] Re: Common IO structure > Date: Mon, 26 Apr 2004 22:56:59 +0200 > > > Of course, sharing the same method name is possible, in ocamlnet we have > > e.g. output_char where camomile has put_char. So the question is whether > > this is worth the effort. > > Camomile uses "put", not "put_char", because channels are polymorphic. Oh sorry, I just remembered it wrong. > If ocamlnet channels have input/output for strings, but have > output_char for one Unicode character, then I would say output_char is > different from Camomile "put", because Camomile "put" is supposed to > output one atom (for character channles, atom is char, not a Unicode > character.) Yes, in principle, they are different. > Since I am convinced by Gerd's argument for close_in/close_out, I > updates my proposal as > (for input) > ['a] object > get : unit -> 'a > close_in : unit > end > (raise End_of_file when there is no more element to read.) > > (for output) > ['a] object > put : 'a -> unit > flush : unit -> unit > close_out : unit -> unit > end > > for a character channel, > (for input) > object > input : string -> int -> int -> int > close_in : unit > end > > ([c#input s pos len] fills s from pos with less than [len] characters, > and returns the number of characters really filled.) > > (for output) > object > output : string -> int -> int -> unit > flush : unit -> unit > close_out : unit -> unit > end > ([c#output s pos len] outputs [len] characters from the position > [pos]) > > But the distinction of put/input, get/output may be confusing. Hmmm. I am sure we are very close to a solution here. As another name for get/put we also have receive/send. The Event module of the stdlib uses them. Gerd -- ------------------------------------------------------------ Gerd Stolpmann * Viktoriastr. 45 * 64293 Darmstadt * Germany gerd@gerd-stolpmann.de http://www.gerd-stolpmann.de ------------------------------------------------------------ ------------------- 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