guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: string-map arg order


From: Dirk Herrmann
Subject: Re: string-map arg order
Date: Mon, 3 Sep 2001 22:09:45 +0200 (MEST)

On 30 Aug 2001, Alex Shinn wrote:

> After sleeping on it, I realized another disadvantage of utf16 is that
> string-set! and other mutators may have to resize the string, if
> you're converting from a two code char to a one code char, or vice
> versa.  This probably means the string mutators have to be special
> forms which do a set! in these cases.  The statistical probability of
> this is small enough that it isn't an efficiency concern, but it does
> cause problems with shared substrings (a mutator may or may not affect
> a shared substring).

With shared substrings you would have a copy-on-write semantics anyway.
That is, any string that is mutated needs to be copied if it shares memory
with other strings.  This, btw., leads to a symmetry between a 'master'
and its shared substrings, each of which can also have shared substrings
of its own.

However, I fully agree with you about the problems of multiple-width
encodings:  In case of multiple threads, every access to one of a string's
characters needs to recompute the memory location of that character,
because some other thread might have changed the string and even replaced
some characters of different encoding widths.

I have difficulties to believe that variable with encodings could
practically work in the context of multithreading at all.

Best regards,
Dirk Herrmann




reply via email to

[Prev in Thread] Current Thread [Next in Thread]