[r6rs-discuss] [Formal] String positions and string slices
Abdulaziz Ghuloum wrote:
> What's the real problem that this proposal attempts to solve?
I think John is right about this, although maybe he hasn't gone far
enough. Historically, strings were treated equivalently to byte
vectors, but this is no longer an appropriate view. We should be
thinking of strings as pieces of text that can be manipulated by
slicing, concatenation, searching, and a very small number of
transformations (e.g. case canonicalization). The fact that one of
these things is equivalent to some sequence of code points is mostly
irrelevant.
Given this view, I think that strings should be read-only, and that
operations like string-length and string-ref are a bad idea. Positions
should be pointers into strings that can be used to ask questions like
"what is the character on my right (or left)?" and "is there a character
to my left (right)?". Positions shouldn't be independent of the strings
they reference, they should instead incorporate those strings.
The real problem is that text representation is a complex topic, and the
existing string implementation imposes unreasonable restrictions on the
possible choices. If we are serious about providing powerful and
efficient support for text, we will need to make some radical changes
here. However, in the interest of backwards compatibility, I'd like to
see names that don't conflict with those in common use.
Received on Mon Apr 09 2007 - 11:02:49 UTC
This archive was generated by hypermail 2.3.0
: Wed Oct 23 2024 - 09:15:01 UTC