Double bracket "{{" for scoping static foreach is no longer part of D

Era Scarecrow rtcvb32 at yahoo.com
Sun Dec 26 15:46:03 UTC 2021


On Wednesday, 22 December 2021 at 16:30:06 UTC, data pulverizer 
wrote:
> On Wednesday, 22 December 2021 at 16:10:42 UTC, Adam D Ruppe 
> wrote:
>> So OUTSIDE a function, static foreach() {{ }} is illegal 
>> because a plain {} is illegal outside a function.
>>
>> But INSIDE a function, static foreach() {{ }} is legal, but it 
>> isn't magic about static foreach - it is just a body with its 
>> optional {} present as well as a scope statement inside.
>
> Just seen this. Thanks - I should have been more patient.

  I thought the {{ }} was mostly related to static if, namely that 
when you do static if, the block contents is added in scope; So 
if you needed a scope you'd do the second bracket as the 
outer/first one is stripped out.

  I need to once again re-familiarize myself more with D. It's 
been too long.


More information about the Digitalmars-d-learn mailing list