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 XAA26569; Wed, 28 Apr 2004 23:30:44 +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 XAA26558 for ; Wed, 28 Apr 2004 23:30:43 +0200 (MET DST) Received: from rabelais.socialtools.net (rabelais.socialtools.net [81.2.94.243]) by nez-perce.inria.fr (8.12.10/8.12.10) with ESMTP id i3SLUfjq006505 for ; Wed, 28 Apr 2004 23:30:42 +0200 Received: by rabelais.socialtools.net (Postfix, from userid 108) id 86BCB232DE; Wed, 28 Apr 2004 22:30:41 +0100 (BST) Received: from socialtools.net (chaucer.socialtools.net [81.2.94.242]) by rabelais.socialtools.net (Postfix) with ESMTP id 50210232DB; Wed, 28 Apr 2004 22:30:40 +0100 (BST) Message-ID: <40902265.9040702@socialtools.net> Date: Wed, 28 Apr 2004 22:30:13 +0100 From: Benjamin Geer User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040113 X-Accept-Language: en-gb, en, fr, it MIME-Version: 1.0 To: John Goerzen Cc: caml-list@inria.fr Subject: Re: [Caml-list] Re: Common IO structure References: <016401c42bc4$b6438840$19b0e152@warp> <20040428.004358.45522587.yoriyuki@mbg.ocn.ne.jp> <016501c42c73$24e64b30$ef01a8c0@warp> <20040428.015800.126758722.yoriyuki@mbg.ocn.ne.jp> <408EEE3E.7050008@socialtools.net> <20040428034415.GB19564@complete.org> In-Reply-To: <20040428034415.GB19564@complete.org> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on rabelais.socialtools.net X-Spam-Status: No, hits=-4.9 required=5.0 tests=BAYES_00 autolearn=ham version=2.63 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 2004:99 nio:99 api:01 layered:01 wrappers:01 cannasse:01 nio:99 python:01 readline:01 extlib:01 abstractions:01 readline:01 encodings:01 unicode:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk John Goerzen wrote: > On Wed, Apr 28, 2004 at 12:35:26AM +0100, Benjamin Geer wrote: > >>In Java there are two I/O libraries, the original one (java.io)[1] and >>the new one (java.nio)[2]. The old one has the virtue of being easy to >>understand and use, and flexible enough for many situations. The basic > > Uh, no. I don't have the API reference in front of me, I provided links to it in the very message you're replying to. > but I seem to > recall somewhere around a dozen or so predefined classes for doing > I/O... I've been using java.io every day for several years, and I find those classes simple and intuitive, particularly the layered approach of using wrappers to add functionality to stream objects, as Nicholas Cannasse points out in another message. However, I agree that there are too many classes in java.nio; I'm pretty sure something simpler can be done in Caml using its more powerful polymorphism. > Python is simple. One standard for everything. You get read(), > write(), readline(), readlines(), xreadlines() (hello Extlib, this one's > for you), seek(), etc. This can apply to files, strings, sockets, > pipes, whatever. Before we can start fussing about unicode > abstractions, I think we need to have a uniform I/O layer. OK, but then you can leave out readline(), readlines() and xreadlines(), because they don't make any sense unless you've already dealt with character encodings. Then, before you can divide text into lines, you also need to know which newline character(s) to use. This needs to be configurable programmatically rather than guessed based on the platform the program is running on; some protocols require you to use \r\n regardless of the platform. Ben ------------------- 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