Nikolai Weibull wrote:
> * Glenn Parker (Mar 20, 2005 16:00):
> 
>>>Well, the problem is that a String is represented by one long
>>>sequence of bytes in memory.
> 
>>AFAIK, that is not actually a requirement for a Ruby implementation.
> 
> What does that mean?  That is how it's implemented in Ruby.  There's no
> definition of how Ruby should be implemented.

Sure there is: a Ruby implementation should implement the Ruby language 
as currently defined.  What I'm saying is that there is nothing in the 
definition of the Ruby language that forces an implementor to use 
contiguous blocks of memory for strings or arrays.  Managing large 
strings as linked chunks is something text editors already do for 
performance.  Assertions about how strings should or should not be used 
are based, in part, on assumptions that should be questioned.

> The implementation is the standard.

I would rather say:
The most widely used implementation is the de facto standard.  :)

> That isn't to say that they are the final word of how a
> String should be represented, but if it will, in a future release, be
> represented in some other way, perhaps having destructive versus
> non-destructive methods will make no sense,

I think what I'm suggesting would actually make destructive methods more 
appealing, without reducing the object creation overhead for 
non-destructive methods.

-- 
Glenn Parker | glenn.parker-AT-comcast.net | <http://www.tetrafoil.com/>