Re: New draft of SRFI 130: Cursor-based string library Alex Shinn 23 May 2016 02:49 UTC
On Sun, May 22, 2016 at 2:23 AM, William D Clinger <xxxxxx@ccs.neu.edu> wrote: > > As for whether we really need SRFI 130, that's a different > question. I think the better approach is to define a new > data type of immutable texts, using strings only for those > few use cases that really need mutation. Immutable texts > can combine O(1)-time random access with the spatial efficiency > associated with UTF-8. Could you elaborate? I haven't seen any proposals that could guarantee O(1)-time random access and still allow UTF-8 or UTF-16. I've seen proposals that optimize for the ASCII-only case, but this isn't very encouraging to people who work with multi-lingual text. I initially thought immutable texts was the way to go, but from a practical standpoint using disjoint cursors on the same basic string type minimizes API fragmentation. In particular, any API that just wants a piece of "text" and doesn't need cursors/indexes doesn't need two versions. When you _do_ care about indexing you can make the API polymorphic on just the cursors, avoiding string conversions. -- Alex