Fix Phobos dependencies on autodecoding
Daniel Kozak
kozzi11 at gmail.com
Tue Aug 13 09:48:16 UTC 2019
On Tue, Aug 13, 2019 at 9:35 AM a11e99z via Digitalmars-d
<digitalmars-d at puremagic.com> wrote:
>
> 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?
>
I hate autodecoding for many reason, one of them it is not done right:
https://run.dlang.io/is/IHECPf
```
import std.stdio;
void main()
{
string strd = "é🜢🜢࠷❻𐝃";
size_t cnt;
foreach(i, wchar c; strd)
{
write(i);
}
writeln("");
foreach(i, char c; strd)
{
write(i);
}
writeln("");
foreach(i, dchar c; strd)
{
write(i);
}
}
```
More information about the Digitalmars-d
mailing list