dmd foreach loops throw exceptions on invalid UTF sequences, use replacementDchar instead

FeepingCreature feepingcreature at gmail.com
Thu Nov 4 05:34:29 UTC 2021


On Thursday, 4 November 2021 at 02:26:20 UTC, Walter Bright wrote:
> https://issues.dlang.org/show_bug.cgi?id=22473
>
> I've tried to fix this before, but too many people objected.
>
> Are we fed up with this yet? I sure am.
>
> Who wants to take up this cudgel and fix the durned thing once 
> and for all?
>
> (It's unclear if it would even break existing code.)

I still think this is a mistake.

One may disagree about autodecoding; I for one think it's a 
sensible idea. However, a program should either process data 
correctly or, if that is impossible, not at all. It should not, 
ever, silently modify it "for you" while reading! I predict this 
will lead to cryptic, hair-pulling bugs in user code involving 
replacement characters appearing far downstream of the error site.


More information about the Digitalmars-d mailing list