Narrow string is not a random access range
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Tue Oct 23 09:35:55 PDT 2012
On 10/23/12 12:35 PM, Andrei Alexandrescu wrote:
> On 10/23/12 11:58 AM, mist wrote:
>> On Tuesday, 23 October 2012 at 15:55:23 UTC, Andrei Alexandrescu wrote:
>>> On 10/23/12 11:36 AM, mist wrote:
>>>> Was thinking on this topic after seeing this:
>>>> http://stackoverflow.com/questions/13014999/cannot-slice-taker-from-std-range-in-d
>>>>
>>>>
>>>>
>>>> Still can't understand rationale here. Why native slicing / random
>>>> access is allowed for narrow strings, but trait explicitly negates
>>>> this?
>>>
>>> Historical mistake.
>>>
>>> Andrei
>>
>> Is string random access gonna be deprecated some day then or this is
>> considered a mistake we need to get used to? :)
>
> Walter is unconvinced it's a mistake, which doesn't make it any easier.
> If I had my way, I'd require people to write str.rep[6] to access the
> sixth byte in the representation of a UTF-8 or UTF-16 string. It would
> make D's strings from great to indistinguishable from perfect.
>
> Andrei
s/byte/code unit/
More information about the Digitalmars-d-learn
mailing list