DIP 57: static foreach

bearophile bearophileHUGS at lycos.com
Sun Mar 9 14:47:15 PDT 2014


Timon Gehr:

> http://wiki.dlang.org/DIP57

> With these semantics, tuple foreach, eg:
> 
> void main(){
>     foreach(x;Seq!(1,2)){ ... }
> }
> 
> is equivalent to static foreach with an additional pair of 
> curly brackets, eg:
> 
> void main(){
>     static foreach(x;Seq!(1,2)){ { ... } }
> }

Having three kinds of foreach in a language is too much. So I 
suggest to add to DIP57 one more thing: that the introduction of 
static foreach should come with a warning against the usage of 
not-static foreach on tuples (and eventually this warning should 
become a deprecation message).

Bye,
bearophile


More information about the Digitalmars-d mailing list