Why foreach(c; someString) must yield dchar

dsimcha dsimcha at yahoo.com
Thu Aug 19 06:17:36 PDT 2010


== Quote from dsimcha (dsimcha at yahoo.com)'s article
> I've been hacking in Phobos and parallelfuture and I've come to the conclusion
> that having typeof(c) in the expression foreach(c; string.init) not be a dchar
> is simply ridiculous.

BTW, what are some examples of where making dchar the default would **silently**
break code?  I can think of very few because now that we've gotten rid of implicit
narrowing conversions in D2, you can't implicitly convert a dchar to a char or a
byte.  This should catch most cases at compile time.



More information about the Digitalmars-d mailing list