dmd foreach loops throw exceptions on invalid UTF sequences, use replacementDchar instead
Walter Bright
newshound2 at digitalmars.com
Fri Nov 5 04:02:44 UTC 2021
On 11/4/2021 7:41 PM, Mathias LANG wrote:
> If you want to fix it, just deprecate the special case and tell people to use
> `foreach (dchar d; someString.byUTF!(dchar, No.useReplacementDchar))` and voilà.
> And if they don't want it to throw, it's shorter:
> `foreach (dchar d; someString.byUTF!dchar)` (or `byDChar`).
People will always gravitate towards the smaller, simpler syntax. Like []
instead of std::vector<>.
More information about the Digitalmars-d
mailing list