[Issue 6652] foreach parameter with number range is always ref

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Jun 16 05:05:09 PDT 2012


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



--- Comment #12 from bearophile_hugs at eml.cc 2012-06-16 05:07:21 PDT ---
(In reply to comment #10)

> They are the phases to change behavior.

I see.


> I think we should allow modifying loop
> variable in foreach body, but it should not affect to iteration.

Generally changing the iteration variable isnt't a very good idea. It looks
bug-prone, like modifying function arguments inside functions :-)

foreach (i; 0 .. 10) { i++; writeln(i); }


> So there is no
> code that changes the foreach-on-range iteration variable.

Good.

-- 
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