The Case Against Autodecode

Timon Gehr via Digitalmars-d digitalmars-d at puremagic.com
Thu Jun 2 14:23:52 PDT 2016


On 02.06.2016 22:51, Andrei Alexandrescu wrote:
> On 06/02/2016 04:50 PM, Timon Gehr wrote:
>> On 02.06.2016 22:28, Andrei Alexandrescu wrote:
>>> On 06/02/2016 04:12 PM, Timon Gehr wrote:
>>>> It is not meaningful to compare utf-8 and utf-16 code units directly.
>>>
>>> But it is meaningful to compare Unicode code points. -- Andrei
>>>
>>
>> It is also meaningful to compare two utf-8 code units or two utf-16 code
>> units.
>
> By decoding them of course. -- Andrei
>

That makes no sense, I cannot decode single code units.

BTW, I guess the reason why char converts to wchar converts to dchar is 
that the lower half of code units in char and the lower half of code 
units in wchar are code points. Maybe code units and code points with 
low numerical values should have distinct types.


More information about the Digitalmars-d mailing list