[Issue 9009] allow foreach without identifier

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sat Jun 14 05:39:02 PDT 2014


https://issues.dlang.org/show_bug.cgi?id=9009

--- Comment #8 from Nick Treleaven <ntrel-public at yahoo.co.uk> ---
Just to note that a related issue is:

foreach (i, Unused; ...)

This may be more common than the foreach (Unused; ...) case - see:

http://forum.dlang.org/post/lnhelg$g01$1@digitalmars.com

A possible solution for both is to use '__' for the unused variable, but the
language enforces that __ is never used and is allowed to shadow:

http://forum.dlang.org/post/vawgobhmtjjjetsegkqj@forum.dlang.org

Note that __ is already a reserved identifier.

--


More information about the Digitalmars-d-bugs mailing list