[Issue 9009] New: allow foreach without identifier
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Nov 12 07:57:55 PST 2012
http://d.puremagic.com/issues/show_bug.cgi?id=9009
Summary: allow foreach without identifier
Product: D
Version: unspecified
Platform: All
OS/Version: All
Status: NEW
Severity: enhancement
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: monarchdodra at gmail.com
--- Comment #0 from monarchdodra at gmail.com 2012-11-12 07:57:54 PST ---
Minor enhancement request, but the language should allow using "foreach"
without specifying an iteration name. THis can be useful when you want to
iterate a fixed amount, without caring about the index. For example, when you
want to "popFrontN exactly" (popFrontN is safe, so slightly slower), you'd want
to write:
foreach( ; 0 .. n ) r.popFront();
Right now, if you do this, you get:
main.d(5): Error: basic type expected, not ;
main.d(5): Error: no identifier for declarator int
for can do without declarators, I don't see why foreach can't have the above
syntax.
Just a minor ER, but I think it would make foreach that little extra user
friendly.
--
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