Re: Fundamental operations on strings
bear 14 Jul 2005 00:02 UTC
On Wed, 13 Jul 2005, Shiro Kawai wrote:
>The current draft says:
> Like in R5RS, a Scheme string is a fixed-length
> array of Scheme characters.
> What R5RS says is "Strings are sequences of
> characters." Although having make-string,
> string-ref and string-set! as primitives suggests
> R5RS authors had an array model in their mind, a
> string can be implemented differently. If strings
> are meant to manipulate texts, as stated in this
> srfi, such alternative implementation can even be
> better than the simple "fixed-length mutable array
> of characters" view.
I strongly agree. Using Unicode makes length-changing
mutations even more likely than before, and frequently
forces it in unexpected situations where the end-user
won't understand or expect it; implementors need to be
free to implement strings in a way that makes
length-changing mutations efficient. Don't stick them
to a fixed-length mutable array.
In particular, don't spec something that outlaws "ropes";
they are much closer to being "the right thing."
Bear