Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
From: Yamagata Yoriyuki <yoriyuki@m...>
Subject: Re: [Caml-list] Re: Common IO structure
From: John Goerzen <jgoerzen@complete.org>
Subject: Re: [Caml-list] Re: Common IO structure
Date: Thu, 29 Apr 2004 08:03:35 -0500

> 
> On Thu, Apr 29, 2004 at 07:27:46PM +0900, Yamagata Yoriyuki wrote:
> > > > >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.
> > > 
> > > No, they can simply be implemented in terms of read().
> > 
> > It will break when UTF-16/UTF-32 are used.  The line separator should
> > be handled after code conversion.  At least that is the idea of
> > Unicode standard.  (But Since Unicode standard is challenged by
> > reality in every aspect, maybe nobody cares.)
> 
> You are missing the point.  read() could handle the code conversion.

No, what I wanted to say is that the line separator should be handled
in the Unicode level, not the byte-character level.  Your design
assumes read() always returns new line characters as in ASCII.  This
would not hold when read() returns UTF-16/UTF-32.

-------------------
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