Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Stop at exception
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Jerome Vouillon <jerome.vouillon@i...>
Subject: Re: [Caml-list] Non-mutable strings
On Wed, Jan 16, 2002 at 08:22:36PM +0100, Mattias Waldau wrote:
> A unicode char is between 1 and 4 bytes, that means that str[i] doesn't work
> (unless you do as NT or Java, store it as wide chars internally, which of
> course Ocaml could do too). You always have to start at the beginning of the
> string to find the i:th char.

Is this really a problem?  It seems to me that you very rarely need
to do this.

NT uses internally the UTF-16 encoding, where a unicode character
takes either 2 or 4 bytes, so you cannot easily find the i-th
character either.

Java is broken and only support Unicode characters that fit in two
bytes.

> Thus, introducing Unicode strings (or something similar, I heard that Asians
> don't like Unicode at all) and introducing non-mutable strings should
> preferrable be done simultaneously.

Yes, Unicode support seems to be a good opportunity to introduce
non-mutable strings.

> In order to have 8-bit chars strings and unicode strings simultaneously we
> need something like 'u"', and maybe the possibility to say that all strings
> are unicode. Can this be done using a module just like 'open Float'
> redefines '+' to '+.'?
> 
> Or should Ocaml v 4 go the whole way and let all strings (also identifiers)
> be Unicode?

We can go a long way without specific support from the language.  In
my opinion, we should first write a good Unicode library and only then
start to think about language support.

-- Jérôme
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr