[review] new string type

Ellery Newcomer ellery-newcomer at utulsa.edu
Tue Nov 30 15:31:05 PST 2010


On 11/30/2010 12:52 PM, Steven Schveighoffer wrote:
> On Tue, 30 Nov 2010 13:34:50 -0500, Jonathan M Davis
>
>> 4. Indexing is no longer O(1), which violates the guarantees of the index
>> operator.
>
> Indexing is still O(1).
>
>> 5. Slicing (other than a full slice) is no longer O(1), which violates
>> the
>> guarantees of the slicing operator.
>
> Slicing is still O(1).
>

There definitely is value in being able to index and slice into utf 
strings without resulting in invalid utf, but I think the fact that it 
indexes on code unit and returns code point is sufficiently strange that 
it qualifies as abuse of operator overloading.

That said, I like this proposal better than the current state of 
affairs. I'll try to play with it more on the weekend


More information about the Digitalmars-d mailing list