[Issue 6652] foreach parameter with number range is always ref
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Sep 12 14:36:09 PDT 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6652
--- Comment #2 from dawg at dawgfoto.de 2011-09-12 14:35:51 PDT ---
Making a const/immutable copy is not the right solution to this.
Instead a mutable copy of a hidden loop variable should be made.
Being a copy is the common behavior for non-ref foreach arguments,
to my surprise it has even become my intuitive assumption of what's happening.
The old behavior can be achieved through a ref argument.
not possible using const:
foreach(i; 1 .. 10)
while(i--) { do some }
--
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