standard ranges

David Nadlinger see at klickverbot.at
Thu Jun 28 02:53:55 PDT 2012


On Thursday, 28 June 2012 at 09:49:19 UTC, Jonathan M Davis wrote:
>> char[] is not treated as an array by the library, and is not 
>> treated as a RandomAccessRange. That is a second 
>> inconsistency, and it would be avoided is string were a struct.
>
> So, it looked to me like you were saying that making string a 
> struct would
> make it so that it was a random access range, which would mean 
> implementing
> length, opSlice, and opIndex.

I think he meant that the problem would be solved because people 
would be less likely to expect it to be a random access range in 
the first place.

What troubles me most with having is(string == immutable(char)[]) 
is that it more or less precludes us from adding small string 
optimizations, etc. in the future…

David


More information about the Digitalmars-d mailing list