[Issue 4085] Steps toward a static foreach
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Aug 22 16:50:08 PDT 2013
http://d.puremagic.com/issues/show_bug.cgi?id=4085
--- Comment #10 from bearophile_hugs at eml.cc 2013-08-22 16:50:01 PDT ---
Adapted from two comments by Timon Gehr:
> It's important to keep them separate regardless. static foreach is close
> to useless if it introduces a new scope for its body.
>
> I.e.:
>
> int main() {
> foreach (_; Seq!int) {
> int x;
> }
> return x; // error
> }
>
> int main() {
> static foreach (_; Seq!int) {
> int x;
> }
> return x; // ok
> }
>
> I think the relationship between foreach and static foreach
> should essentially mirror that of if and static if.
--
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