Making all strings UTF ranges has some risk of WTF
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Wed Feb 3 20:43:39 PST 2010
Rainer Deyke wrote:
> Andrei Alexandrescu wrote:
>> - make front() and back() for UTF-8 and UTF-16 automatically decode the
>> first and last Unicode character
>>
>> - make popFront() and popBack() skip one entire Unicode character
>> (instead of just one code unit)
>>
>> - alter isRandomAccessRange to return false for UTF-8 and UTF-16 strings
>>
>> - change hasLength to return false for UTF-8 and UTF-16 strings
>
> These are all fine for a dedicated string type. They're horrible for
> generic arrays, for the following reasons:
> - They break generic code.
> - They make it impossible to manipulate an array of code units as an
> array of code units.
Arrays of char and wchar are not quite generic - they are definitely UTF
strings.
Andrei
More information about the Digitalmars-d
mailing list