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-30 (03:40)
From: Benjamin Geer <ben@s...>
Subject: Re: [Caml-list] Re: Common IO structure
John Goerzen wrote:
> What you have proposed here is exactly what I am proposing and what
> Python does.  It appears we are somehow in complete agreement about what
> should happen.  I guess the disagreement is whether it is like Java.  I
> maintain it is not, since there is a single File object that is used for
> everything -- both files themselves and various converters.

A basic difference between Python and Java, perhaps, is that Java makes 
a strict distinction between bytes and characters.  In Java, characters 
are always Unicode characters.  Since the most basic kind of stream 
(what you're calling a 'file object') can't possibly be a converter, its 
interface can't return characters.  Therefore, in Java, at some point 
you need a different interface, what you could call a 'file object that 
knows about characters', which Java calls Reader.

However, in Caml we can surely do better, as the 'Common IO Structure' 
thread shows; the basic file/channel/stream type can be polymorphic. 
Now if only Nicholas Cannasse, Gerd Stolpmann and Yamagata Yoriyuki can 
only agree on the type parameters... :)


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