VLERange: a range in between BidirectionalRange and RandomAccessRange

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Tue Jan 11 08:54:08 PST 2011


On 1/11/11 5:30 AM, Steven Schveighoffer wrote:
> While this makes it possible to write algorithms that only accept
> VLERanges, I don't think it solves the major problem with strings --
> they are treated as arrays by the compiler.

Except when they're not - foreach with dchar...

> I'd also rather see an indexing operation return the element type, and
> have a separate function to get the encoding unit. This makes more sense
> for generic code IMO.

But that's neither here nor there. That would return the logical element 
at a physical position. I am very doubtful that much generic code could 
work without knowing they are in fact dealing with a variable-length 
encoding.

> I noticed you never commented on my proposed string type...
>
> That reminds me, I should update with suggested changes and re-post it.

To be frank, I think it didn't mark a visible improvement. It solved 
some problems and brought others. There was disagreement over the 
offered primitives and their semantics.

That being said, it's good you are doing this work. In the best case, 
you could bring a compelling abstraction to the table. In the worst, 
you'll become as happy about D's strings as I am :o).


Andrei



More information about the Digitalmars-d mailing list