Making all strings UTF ranges has some risk of WTF
Rainer Deyke
rainerd at eldwood.com
Wed Feb 3 20:18:05 PST 2010
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.
--
Rainer Deyke - rainerd at eldwood.com
More information about the Digitalmars-d
mailing list