status: final (2017-05-24)
keywords: Data Structure
See also SRFI 118: Simple adjustable-size strings and SRFI 135: Immutable Texts.This attempts to solve the same issues with R7RS strings raised by SRFI-135, but with better integration with the Scheme language.
We propose to retain the name string as the type of sequences of Unicode characters (scalar values). There are two standard subtypes of string:
string-set!
on an istring throws an error. On the
other hand, the core operations string-ref
and
string-length
are guaranteed to be O(1).
in-placeusing
string-set!
and other operations.
However, string-ref
, string-set!
, or
string-length
have no performance guarantees. On many
implementation they may take time proportional to the length of the
string.
An implementation may support other kinds of
strings. For example on the Java platform it may be reasonable to
consider any instance of java.lang.CharSequence
to be a
string.
The main part of the proposal specifies the default bindings of various procedure names, as might be pre-defined in a REPL. Specifically, some procedures that traditionally return mutable strings are changed to return istrings. We later discuss compatibility and other library issues.