On Dec 16, 2007 6:50 PM, Per Bothner <[EMAIL PROTECTED]> wrote: > Java doesn't doesn't support "string as a sequence of > Unicode scalar value" very well. And this is mandated > by some recent languages, including Scheme R6RS, and > XQuery/XSLT/XPath.
That's quite true. In a wider sense, though, that particular way of slicing up a Unicode string isn't particularly privileged over any other. Alternative levels include: * the UTF-8 code unit * the UTF-16 code unit * the default grapheme cluster (which combines a base with its diacritics, the parts of a Korean hangul syllable, and CR with LF) * the Indic syllable or Tibetan consonant stack or similar physical unit of linear text propagation Above that, of course, we have words (which may or may not be separated by a specialized character such as space or zero-width space), sentences, and paragraphs. All these things can be handled on the JVM by the subclasses of BreakIterator; unfortunately, the other textual services of the platform are not built on top of them. All of these sequential representations have advantages for some purposes and disadvantages for other purposes. Rarely is random access to the components of the string particularly useful; what's important is providing fast iteration over those components. I hope that as time goes on, just as languages have accepted Unicode as a base representation, they will come to accept iterators as a base access method, with strings seen as neither atoms nor sequences, but a tertium quid that can be iteratively dissected into parts (which are also strings) in any of a large variety of ways. -- GMail doesn't have rotating .sigs, but you can see mine at http://www.ccil.org/~cowan/signatures --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "JVM Languages" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/jvm-languages?hl=en -~----------~----~----~----~------~----~------~--~---
