Dealing with Autodecode

Steven Schveighoffer via Digitalmars-d digitalmars-d at puremagic.com
Tue May 31 18:20:24 PDT 2016


On 5/31/16 8:46 PM, Walter Bright wrote:
> It is not practical to just delete or deprecate autodecode - it is too
> embedded into things. What we can do, however, is stop using it
> ourselves and stop relying on it in the documentation, much like [] is
> eschewed in favor of std::vector in C++.
>
> The way to deal with it is to replace reliance on autodecode with
> .byDchar (.byDchar has a bonus of not throwing an exception on invalid
> UTF, but using the replacement dchar instead.)
>
> To that end, and this will be an incremental process:
>
> 1. Temporarily break autodecode such that using it will cause a compile
> error. Then, see what breaks in Phobos and fix those to use .byDchar
>
> 2. Change examples in the documentation and the Phobos examples to use
> .byDchar
>
> 3. Best practices should use .byDchar, .byWchar, .byChar, .byCodeUnit
> when dealing with ranges/arrays of characters to make it clear what is
> happening.

I gotta be honest, if the end of this tunnel doesn't have a char[] array 
which acts like an array in all circumstances, I see little point in 
changing anything.

-Steve


More information about the Digitalmars-d mailing list