guile-devel
[Top][All Lists]
Advanced

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

Re: string-map arg order


From: Alex Shinn
Subject: Re: string-map arg order
Date: 30 Aug 2001 10:44:40 -0400
User-agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/21.0.104

>>>>> "Alex" == Alex Shinn <address@hidden> writes:

    Alex> utf16 sounds nice, and would be most commonly used
    Alex> in other applications and libraries (important since Guile
    Alex> is meant to be easy to extend and embed with C), but there
    Alex> are a small percentage of characters that require two code
    Alex> units.  This would probably mean two char types: immediate
    Alex> and non-immediate.  It also means that (without clever
    Alex> optimizing when there are no two code chars) accessing a
    Alex> character in a string is no longer constant time.

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).

Also, ports would actually have two modes for I/O: raw and utf8.  If
we went with utf16 for strings we might also want to allow this as a
port mode to simplify string ports.  Other character sets, as well as
compression/encryption/any encoding, are probably best handled by soft
port wrappers around the underlying port.

Of course, I'm not actually proposing anything, just getting a feel
for what thought people have put into this and what some of the
biggest hurdles might be.

-- 
Alex Shinn <address@hidden>



reply via email to

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