[r6rs-discuss] [Formal] String positions and string slices
cph at csail.mit.edu
Tue Apr 10 00:16:39 EDT 2007
John Cowan wrote:
> William D Clinger scripsit:
>> Quibble: I think the historical view of strings should be
>> continued for backwards compatibility with Scheme tradition.
> In that case, you also have to make characters something other than
> Unicode scalar values, or else go to very tricky implementations.
> I'm trying to break as little of R5.92RS as possible.
I think the best way to do this is to separate the two views.
> I think the only way to make this fly is to introduce a CL-style
> distinction between characters (in texts) and basic characters
> (in strings), though keeping the name "character". Alternatively,
> we could say that strings are sequences of Scheme character objects, but the
> atomic unit of texts is a text containing a single (Unicode) character.
Or we could say that strings contain only a small subset, e.g. ISO
8859-1 or US-ASCII.
> However, I'd be pretty unhappy with doubling up like this. There is
> little or nothing that strings can do that texts cannot.
Except that the only strong argument for keeping the string interface is
historical compatibility. Why not just keep it, then, and develop a
better interface in parallel?
> For that matter, you can implement R5RS strings as vectors,
> provided you are allowed to redefine "vector?". If strings
> are massively more efficient than texts, though, people will
> go on using them.
But if they support only a small subset of characters, that will
discourage their use pretty effectively.
More information about the r6rs-discuss