std.string and std.algorithm: what to do?
Georg Wrede
georg.wrede at iki.fi
Sat May 16 19:39:57 PDT 2009
Benji Smith wrote:
> Andrei Alexandrescu wrote:
>> Yah, I defined
>>
>> enum CaseSensitive { no, yes }
>
> Minor nitpick: there are lots of different ways to canonicalize text
> before performing a comparison. Ascii case conversions are just one way.
>
> Instead of an enum with a yes/no value, what about future-proofing it
> with something more along the lines of...
>
> enum CaseSensitivity {
> None, Ascii, UnicodeChar, UnicodeSurrogatePair
> }
>
> ...or something like that.
>
> The yes/no enum will outlive its usefulness before long.
True, as implemented, case sensitive functions only work on true ASCII
strings in D.
And I hope we don't even try to fix this universally, because the corner
cases involved (including accents in separate entities), simply are too
much to handle. And the only way to try to handle them, while keeping
the code fast, is to first examine the string for any non-ASCII stuff,
and then having two separate case functions for each usage.
More information about the Digitalmars-d
mailing list