From: Matt Armstrong Date: 2003-02-13T08:50:34+09:00 Subject: Re: Should substrings be modifiable in-place?? "Hal E. Fulton" writes: > I've been thinking about this for a half hour or so. > > Rather than writing this kind of thing: > > str[x,y] = str[x,y].reverse > str[x..z] = str[x..z].reverse > > I'd like to be able to do this: > > str[x,y].reverse! > str[x..z].reverse! > > There is probably some good reason this won't work, though. ;) > > Someone care to comment? Implementation problems. The reverse! must be sent to some object -- presumably a "Substring" object that can modify the string it contains. But I'm not sure str#[] should return a non-String. I would love a Substring class, as it would make some of the things I have done in the past easier to write and more efficient. But sometimes I would want modifications to self to modify the owning string, sometimes not. -- matt