The Case Against Autodecode
Andrei Alexandrescu via Digitalmars-d
digitalmars-d at puremagic.com
Thu Jun 2 14:27:34 PDT 2016
On 6/2/16 5:24 PM, ag0aep6g wrote:
> On 06/02/2016 11:06 PM, Andrei Alexandrescu wrote:
>> Nope, that's a radically different matter. As the examples show, the
>> examples would be entirely meaningless at code unit level.
>
> They're simply not possible. Won't compile.
They do compile.
> There is no single UTF-8
> code unit for 'ö', so you can't (easily) search for it in a range for
> code units.
Of course you can. Can you search for an int in a short[]? Oh yes you
can. Can you search for a dchar in a char[]? Of course you can.
Autodecoding also gives it meaning.
> Just like there is no single code point for 'a⃗' so you can't
> search for it in a range of code points.
Of course you can.
> You can still search for 'a', and 'o', and the rest of ASCII in a range
> of code units.
You can search for a dchar in a char[] because you can compare an
individual dchar with either another dchar (correct, autodecoding) or
with a char (incorrect, no autodecoding).
As I said: this thread produces an unpleasant amount of arguments in
favor of autodecoding. Even I don't like that :o).
Andrei
More information about the Digitalmars-d
mailing list