[Issue 14984] New: Make it illegal (or at least a warning) to modify the iteration variable in foreach
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Sun Aug 30 05:26:35 PDT 2015
https://issues.dlang.org/show_bug.cgi?id=14984
Issue ID: 14984
Summary: Make it illegal (or at least a warning) to modify the
iteration variable in foreach
Product: D
Version: D2
Hardware: x86_64
OS: Linux
Status: NEW
Severity: enhancement
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: schuetzm at gmx.net
Modifying the index variable in `foreach` is almost always wrong, for example:
https://github.com/D-Programming-Language/dmd/pull/4991
Thus, it should be deprecated and later forbidden. If someone really wants to,
they can use a normal `for` loop.
--
More information about the Digitalmars-d-bugs
mailing list