DIP 1010--Static foreach--Formal Review

Timon Gehr via Digitalmars-d digitalmars-d at puremagic.com
Wed Jul 12 03:27:53 PDT 2017


On 11.07.2017 09:50, Daniel N wrote:
> On Monday, 10 July 2017 at 08:53:42 UTC, Mike Parker wrote:
>> As promised, since there has been zero feedback on DIP 1010, "Static 
>> foreach", in either the Draft or Preliminary review rounds, I'm going 
>> to skip the normal two-week feedback cycle on the Formal review. If 
>> there are no major criticisms or objections raised in this thread, 
>> then sometime on Thursday of this week I'll send Walter & Andrei an 
>> email kicking off the decision process.
>>
>> So, if you have any thoughts on the DIP, now is the time to express them.
>>
>> Thanks!
>>
>> https://github.com/dlang/DIPs/blob/master/DIPs/DIP1010.md
> 
> how is __local handled with nested static foreach?

The following code works:

---

static foreach(i;0..4){
     static if(i) __local alias outerPrevious = __previous;
     static foreach(j;0..4){
         static if(i&&j){
             pragma(msg, outerPrevious.i," ",__previous.j);
         }
     }
}
---


It prints:

---
0 0
0 1
0 2
1 0
1 1
1 2
2 0
2 1
2 2
---

(However, note that DIP 1010 does not propose adding __local to the 
language.)


More information about the Digitalmars-d mailing list