www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 13522] New: Let's use '_' underscore as official ignore value

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

          Issue ID: 13522
           Summary: Let's use '_' underscore as official ignore value
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: code dawg.eu

Some examples where explicitly ignoring a value is needed.

foreach (_; 0 .. 10) {}
foo((a, _) => a);

A more advanced implementation might also allow to use _ in assignments not
only as declarator.
TypeTuple!(a, b, _) = tup[];

The compiler should disallow to access declarations named _, after deprecation.
The identifier _ should not be checked for variable shadowing to allow nested
declarations of _.
If possible the compiler should not generate code to assign/initialize such
declarations, unless the operation has a side-effect.

--
Sep 23 2014