[Issue 9009] allow foreach without identifier

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Jan 13 13:56:31 PST 2013


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



--- Comment #2 from monarchdodra at gmail.com 2013-01-13 13:56:29 PST ---
(In reply to comment #1)
> I think this is a worthy request, although you can use "_" as an unused
> iteration variable you may end up having to invent unique names with 2 or more
> nested foreach loops:
> 
> foreach(_; 0 .. n ) {
>     foreach(__; 0 .. m) {
>         // statements
>     }
> }
> 
> Since foreach lowers to a for statement I think it should be possible to
> implement the request.
> 
> Can we get a pre-approval from Walter/Andrei?

BTW, given the compiler error that is spit out by DMD upon writing

//----
foreach ( ; 0 .. n )
//----
Error: basic type expected, not ;
Error: no identifier for declarator int
//----

I'd say it is either a bug that this isn't already supported anyway, or the
compiler error should be re-written.

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