RFC on range design for D2

Bill Baxter wbaxter at gmail.com
Fri Sep 12 15:32:38 PDT 2008


On Sat, Sep 13, 2008 at 7:28 AM, Bill Baxter <wbaxter at gmail.com> wrote:
> On Sat, Sep 13, 2008 at 3:21 AM, Denis Koroskin <2korden at gmail.com> wrote:
>> 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.
>
> Err, you just repeated exactly what he said.

Ok sorry I do see a difference now, but you quoted the wrong one of
Fawzi's,  you should have quoted this one:

foreach(i;1..$; j; iterJ; k,l; multiIter){

}

Which I think falls into your "or something like this" category.

--bb


More information about the Digitalmars-d-announce mailing list