English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
[Caml-list] [ANN] The Missing Library
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2004-04-28 (21:30)
From: Benjamin Geer <ben@s...>
Subject: Re: [Caml-list] Re: Common IO structure
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 

> 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 


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