Dealing with Autodecode
Walter Bright via Digitalmars-d
digitalmars-d at puremagic.com
Tue May 31 17:46:04 PDT 2016
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.
More information about the Digitalmars-d
mailing list