RFC on range design for D2

Denis Koroskin 2korden at gmail.com
Fri Sep 12 11:21:45 PDT 2008


On Fri, 12 Sep 2008 20:10:28 +0400, Fawzi Mohamed <fmohamed at mac.com> wrote:

> On 2008-09-12 17:48:02 +0200, Andrei Alexandrescu  
> <SeeWebsiteForEmail at erdani.org> said:
>
>> Fawzi Mohamed wrote:
>>> foreach(i,j,k;1..$,iterJ,a.all){
>>>     //...
>>> }

Foreach over multiple ranges in paraller is great, but it is quite hard to  
match key/value to the ranges in your example, because they are far from  
each other, especially if ranges are evaluated in some (possibly long)  
expressions.

I prefer the following syntax more:

foreach (key0, value0 : range0; value1 : range1; ... ) { // or something  
like this
}

This way key/value and range are close to each other and you don't need to  
move you look back and forth to understand what range does this value  
correspond too.


More information about the Digitalmars-d-announce mailing list