This is the mail archive of the guile@cygnus.com mailing list for the guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: mbstrings



>Jim> There's no nice way to deal with variable-length characters.
>Jim> string-length and string-ref are just hopeless, if you want to
>Jim> preserve the properties promised by R4RS.
>
>I only have R3.99RS here, so I don't know what properties are
>guaranteed.  But many string functions are losers with a multibyte
>encoding.  For instance string-set! can resize the string's buffer.

I mean the real basic properties promised by R4RS (emphases mine):

"Strings are sequences of CHARACTERS."
"The length of a string is the number of CHARACTERS it contains."
"The first character of a string has index 0, the second has index 1,
and so on."
"[string-length] returns the number of CHARACTERS in the given
string."

Notice that these say "characters" and not "bytes".  Thus, operations
like string-length, string-ref, and string-set! become linear in time
complexity.

Which is not cool.