On 08/25/2009 11:31 AM, Thomas Lord wrote:
> Using strings without mutation, whether or not the
> system has such a thing as "immutable strings", is
> a fine programming style for many situations but
> certainly not all.   Perhaps the easiest-to-see examples
> come from systems programming where, for example, a
> string is a natural representation for a buffer of
> characters that is displayed directly on a terminal;
> or, another example, a device driver wants to accumulate
> characters in a string-like buffer before passing them
> to a client program.   In situations like those examples
> you very much want a stable, string-like object (representing
> a fixed region of memory) with mutations on the content
> of the string.

A fixed-size modifiable array of bytes is useful in many
situations - though mostly low-level performance-tuned
libraries, including the examples you mention.

A mutable string or character sequence can be useful, but only
if supports insert and delete - at the very least append.

A mutable fixed-size string has so few uses (I can't think of
any) that there is little point is providing it in a language.
The only use I can think of is to implement a variable-size
string!  If there are any real use cases, they can use a vector.
-- 
        --Per Bothner
[email protected]   http://per.bothner.com/

_______________________________________________
r6rs-discuss mailing list
[email protected]
http://lists.r6rs.org/cgi-bin/mailman/listinfo/r6rs-discuss

Reply via email to