A possible suggestion for the Foreach loop

Dylan Knutson tcdknutson at gmail.com
Wed Aug 21 13:53:54 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

I do like the idea of it being called 'static foreach' instead of 
'foreach', to keep in step with how the rest of the language 
handles other compile time constructs (static assert). Plus, as 
you said in your bugreport, visual disambiguation between that 
and a runtime foreach is nice feedback for the programmer to pick 
up instantly.


More information about the Digitalmars-d mailing list