The Case Against Autodecode

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Thu Jun 2 15:48:03 PDT 2016


On 6/2/2016 3:23 PM, Andrei Alexandrescu wrote:
> On 06/02/2016 05:58 PM, Walter Bright wrote:
>>  > * s.balancedParens('〈', '〉') works only with autodecoding.
>>  > * s.canFind('ö') works only with autodecoding. It returns always
>> false without.
>>
>> Can be made to work without autodecoding.
>
> By special casing? Perhaps.

The argument to canFind() can be detected as not being a char, then decoded into 
a sequence of char's, then forwarded to a substring search.

> I seem to recall though that one major issue with
> autodecoding was that it special-cases certain algorithms. So you'd need to go
> through all of std.algorithm and make sure you can special-case your way out of
> situations that work today.

That's right. A side effect of that is that the algorithms will go even faster! 
So it's good.

(A substring of codeunits is faster to search than decoding the input stream.)



More information about the Digitalmars-d mailing list