Fix Phobos dependencies on autodecoding

a11e99z black80 at bk.ru
Tue Aug 13 07:31:28 UTC 2019


On Tuesday, 13 August 2019 at 07:08:03 UTC, Walter Bright wrote:
> We don't yet have a good plan on how to remove autodecoding and 
> yet provide backward compatibility with autodecoding-reliant 
> projects, but one thing we can do is make Phobos work properly 
> with and without autodecoding.
>
> To that end, I created a build of Phobos that disables 
> autodecoding:
>
> https://github.com/dlang/phobos/pull/7130
>
> Of course, it fails. If people want impactful things to work 
> on, fixing each failure is worthwhile (each in separate PRs).
>
> Note that this is neither trivial nor mindless code editing. 
> Each case has to be examined as to why it is doing 
> autodecoding, is autodecoding necessary, and deciding to 
> replace it with byChar, byDchar, or simply hardcoding the 
> decoding logic.

imo autodecoding is one of right thing.
maybe will be better to leave it as is and just to add
> immutable(ubyte)[] bytes( string str ) @nogc nothrow {
>     return *cast( immutable(ubyte)[]* )&str;
> }
and use it as
> foreach( b; "Привет, Мир!".bytes) // Hello world in RU
>     writefln( "%x", b );          // 21 bytes, 12 runes
?

why u decide to fight with autodecoding?



More information about the Digitalmars-d mailing list