On Wed, Jul 01, 2015 at 02:14:49PM -0400, Steven Schveighoffer via Digitalmars-d-learn wrote: > On 7/1/15 1:44 PM, Steven Schveighoffer wrote: > > >Schizophrenia of Phobos. > > > >Phobos thinks a string is a range of dchar instead of a range of > >char. So what cycle, take, and array all output are dchar ranges and > >arrays. > > > >When you cast the dchar[] result to a string, (which is a char[]), it > >then treats all the 0's in each dchar element as '\0', printing a > >blank apparently. > > This has to be one of the most obvious cases I've ever seen that > phobos treating string as a range of dchar was the wrong decision. > That one can't use ranges to make a new string is ridiculous. Just the > thought of "fixing" this by re-encoding... [...]
Yeah, although Andrei has vetoed all suggestions of getting rid of autodecoding, this is one of the glaring cases where it's obviously a bad idea. It almost makes me want to create my own custom string type that serves up char instead of dchar. T -- There are four kinds of lies: lies, damn lies, and statistics.