Re: Unicode implementation concept

"Mark Davis" <[email protected]> Sat, 24 Jan 2004 15:07:48 -0800
Newsgroups gmane.comp.lib.icu.general
Message-ID <001d01c3e2ce$e2f7b210$6401a8c0@DAVIS1>
I just don't quite see why you are coming to the conclusion you have reached;
that's why I asked for a concrete scenario.

> String manipulation is an exceedingly common operation in all manner of
programming work, right up there with integer addition.

True, but that doesn't mean that random access to code points is an important
operation. Let's take an example. An ICU UnicodeString or a Java String will
contain any sequence of Unicode characters. One can do all sorts of string
manipulation with them: concatenation, substringing, search operations, regular
expression matching, transformations, etc. Indexing into those strings is done
by using code unit indices.

Thus if I do a regex search in a string S, and find a match between <10, 20> (a
pair of code unit indices), I can then do what I want with that information. I
can, for example, extract a substring at that point with S.substring(10,20). I
can then concatenate that to other strings, replace something in the original
string, etc. All of this is done with code unit boundaries.

I do have to be cognizant of code point boundaries for many operations. For
example, if I want to iterate through a string manually, and find the first code
point that has the property Letter. In such a case, I need to fetch code points
rather than just code points as I traverse the string. But I once I find the
position, I can still express the start of that code point as a code unit index.
And generally that process is the only thing I need to worry about, the
iteration through a string forwards or backwards. Random access by means of code
point indices is rarely (if ever) needed.

So that is why I question the need for the kind of extra structure you are
thinking of, and suggested that you describe a concrete case.

Mark
__________________________________
http://www.macchiato.com
► शिष्यादिच्छेत्पराजयम् ◄

----- Original Message ----- 
From: "Mark Evans" <[email protected]>
To: <[email protected]>
Sent: Sat, 2004 Jan 24 14:07
Subject: Re: Unicode implementation concept


> These doubts puzzle me.  String manipulation is an exceedingly common
operation in all manner of programming work, right up there with integer
addition.  The utility of adopting current string/array libraries to a Unicode
framework which does not upset their assumptions about fixed indexing should be
self-evident.
>
> In this case the language designer has working array code that he wishes to
use for string operations like concatenation and slicing.
>
> The argument that supplementary code units are going to be exceedingly rare
argues in favor of the idea, i.e. the price for 100% unequivocal Unicode support
has minimal impact.
>
> Thanks,
> Mark
> _______________________________________________
> icu mailing list
> [email protected]
> http://oss.software.ibm.com/developerworks/oss/mailman/listinfo/icu
>