More fun with autodecoding
Jon Degenhardt
jond at noreply.com
Mon Sep 10 03:25:18 UTC 2018
On Saturday, 8 September 2018 at 15:36:25 UTC, Steven
Schveighoffer wrote:
> On 8/9/18 2:44 AM, Walter Bright wrote:
>> On 8/8/2018 2:01 PM, Steven Schveighoffer wrote:
>>> Here's where I'm struggling -- because a string provides
>>> indexing, slicing, length, etc. but Phobos ignores that. I
>>> can't make a new type that does the same thing. Not only
>>> that, but I'm finding the specializations of algorithms only
>>> work on the type "string", and nothing else.
>>
>> One of the worst things about autodecoding is it is special,
>> it *only* steps in for strings. Fortunately, however, that
>> specialness enabled us to save things with byCodePoint and
>> byCodeUnit.
>
> So it turns out that technically the problem here, even though
> it seemed like an autodecoding problem, is a problem with
> splitter.
>
> splitter doesn't deal with encodings of character ranges at all.
This could partially explain why when I tried byCodeUnit and
friends awhile ago I concluded it wasn't a reasonable approach:
splitter is in the middle of much of what I've written.
Even if splitter is changed I'll still be very doubtful about the
byCodeUnit approach as a work-around. An automated way to
validate that it is engaged only when necessary would be very
helpful (@noautodecode perhaps? :))
--Jon
More information about the Digitalmars-d
mailing list