Email list hosting service & mailing list manager

Re: SRFI 13 redux: a proposed compromise between SRFI 140 and SRFI 152 Per Bothner (31 Mar 2019 01:47 UTC)

Re: SRFI 13 redux: a proposed compromise between SRFI 140 and SRFI 152 Per Bothner 31 Mar 2019 01:47 UTC

On 3/29/19 3:31 PM, Per Bothner wrote:

>> 1) The SRFI 140 distinction between mutable and immutable strings is accepted.  However, although it is an error to attempt to mutate an immutable string. implementations are allowed not to support the distinction between mutable and immutable strings.  In such implementations, all strings are mutable,and there is no guarantee of O(1) behavior.  This is pretty much the SRFI 13 position.
>>
>> 2) The SRFI 140 istring? predicate is replaced with an mstring? predicate.  This returns #t on any string that is in fact mutable; on systems without a distinction it returns #t on all strings.
>
> Ok - I don't feel strongly about this.  Is this any different from allowing systems without a distinction to have istring? return #f on all strings?

One thing to note: SRFI 140 allows an implementation to support strings that are
neither istrings (immutable strings with O(1) indexing) nor mstrings (mutable strings).
Specifically, in Kawa a "string" is any object that implements the java.lang.CharSequence
interface, while an istring is gnu.lists.IString and an mstring is gnu.lists.FString.
The standard Java java.lang.String class is a Kawa "string" but neither an istring or mstring.
(It is immutable but does not have O(1) indexing.)

So the question whether to have istring?, mstring?, or both depends on the intended use.
--
	--Per Bothner
xxxxxx@bothner.com   http://per.bothner.com/