[Issue 17229] File.byChunk (ubyte) w/ stdout.lockingTextWriter corrupts utf-8 data (and is very slow)
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Wed Mar 1 06:25:09 PST 2017
https://issues.dlang.org/show_bug.cgi?id=17229
--- Comment #6 from Steven Schveighoffer <schveiguy at yahoo.com> ---
(In reply to anonymous4 from comment #5)
> static assert(is(ubyte:dchar));
> This assert succeeds. Is it intended? It's why LockingTextWriter accepts
> bytes event though it's a text writer.
Yes, in the compiler, ubyte and dchar are fundamentally unsigned integer types.
You can implicitly convert via integer promotion.
Technically, char can integer promote to dchar as well. However, foreach(dchar
d; someCharArray) is specialized in the compiler to go through auto decoding.
The forums contain volumes of battles on auto-decoding and how the choice has
affected D, I don't think we need to rehash it here. What we need to do is make
it so obviously wrong code is not accepted for this function. I'll try and get
a PR together.
--
More information about the Digitalmars-d-bugs
mailing list