A possible suggestion for the Foreach loop

Dicebot public at dicebot.lv
Wed Aug 21 12:17:09 PDT 2013


On Wednesday, 21 August 2013 at 18:52:56 UTC, bearophile wrote:
> Dicebot:
>
>> This bugzilla entry is on slightly related but different topic.
>>
>> "declaration foreach" != "static foreach"
>
> I think a well implemented "static foreach" is able to do 
> anything a "declaration foreach" could do, and more. (If you 
> don't think so, please show what's missing).
>
> Bye,
> bearophile

They are orthogonal and not exclusive.

"declaration foreach" can appear whenever declaration can appear 
and insert new declarations, contrary to statements of normal 
foreach. "static foreach" is simply an improvement over existing 
"tuple foreach concept" which allows it to work with a wider 
variety of input. Former is about context of  foreach itself, 
latter - about behavior of the loop.


More information about the Digitalmars-d mailing list