standard ranges

Jonathan M Davis jmdavisProg at gmx.com
Thu Jun 28 02:37:17 PDT 2012


On Thursday, June 28, 2012 09:28:52 Christophe Travert wrote:
> I never said strings should support length and slicing. I even said
> they should not. foreach is inconsistent with the way strings are
> treated in phobos, but opIndex, opSlice and length, are inconsistent to.
> string[0] and string.front do not even return the same....
> 
> Please read my post a little bit more carefully before
> answering them.

You said this:

> 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.

- Jonathan M Davis


More information about the Digitalmars-d mailing list