[Issue 14519] [Enh] foreach on strings should return replacementDchar rather than throwing

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed Apr 29 01:01:25 PDT 2015


https://issues.dlang.org/show_bug.cgi?id=14519

bearophile_hugs at eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bearophile_hugs at eml.cc

--- Comment #8 from bearophile_hugs at eml.cc ---
(In reply to Walter Bright from comment #0)

> Changing foreach to return replacementDchar on invalid UTF encodings fixes
> these problems, and makes it possible to do faster loops.

Another solution is to deprecate foreach iteration on strings, and require
something like "foreach(c; mystring.byCharThrowing)" and similar things.

--


More information about the Digitalmars-d-bugs mailing list