Literal empty string is immutable, off course.  What I meant by "empty string" is something that's returned from (string-copy "abc" 0 0) or even, (string-copy "").


On Mon, Feb 24, 2020 at 11:22 AM Per Bothner <xxxxxx@bothner.com> wrote:
On 2/24/20 12:50 PM, Shiro Kawai wrote:
> The thing is, length-changing mutation is diversion from the location-based mutation model--at least in srfi-118, string-append! and string-replace! can't be explained by mutating the value of the original string locations.  It can be explained by introducing an indirection (a string have a single location that points to a location of the storage), but then an empty string can have a location.

It depends what you mean by "empty string".
This may be easier to discuss in the context of srfi-140,
which explicitly discusses mutable vs immutable strings.

A mutable string is clearly a location (object).  If srfi-118 or srfi-140
is supported then the value of a mutable string can be empty, but it is
distinct from the empty string literals.

Immutable strings (including string literals) that have the same value
(same sequence of characters) may be eq?.  Mutable strings are all
distinct objects (not eq?).  A mutable string whose string-length is 0
is never eq? to "", but it is equal?.  According to my reading of r7rs,
no mutable string is eqv? to any other mutable string *or* any immutable
string, including "".
--
        --Per Bothner
xxxxxx@bothner.com   http://per.bothner.com/