On Sunday, 25 August 2013 at 18:13:39 UTC, Joseph Rushton
Wakeling wrote:
On 25/08/13 20:07, Paul Jurczak wrote:
What is the purpose of "immutable _;" above? Why not "i;"?
It's never used, so notating it like this means you'll never
clash with another variable name by accident (e.g. if somewhere
else in the function you declare an int i).
Had never thought of that before but it's a handy trick, I'll
have to make use of it in my own code ...
It never clashes untill you nest two foreach, and then you have
to use __ ...
foreach( _ ; 0 .. M)
foreach( __ ; 0 .. N)
...
I have an enhancement request to simply allow anonymous iteration:
foreach( ; 0 .. N)
http://d.puremagic.com/issues/show_bug.cgi?id=9009