[Issue 9087] Value modified in foreach warning

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Nov 27 20:23:04 PST 2012


http://d.puremagic.com/issues/show_bug.cgi?id=9087



--- Comment #3 from Kenji Hara <k.hara.pg at gmail.com> 2012-11-27 20:23:02 PST ---
(In reply to comment #2)
> But I think the warning I am asking here is one of the better solutions to
> avoid those bugs.

Yes, in many case those *bugs* will be avoided by your enhancement.
However, in few cases, if a user really wants to use the foreach key as a
mutable copy of iterated element, your enhancement will reject such *correct*
code. At least, that is a point described in the bug 6652 comment#0.

Therefore, this is a design selection. One is avoiding "non-effect
modification" bugs with blocking a few valid code. Another is to keep language
expressive with a little more user's learning. I stand on latter, in basic.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list