Divide & Conquer divides, but doesn't conquer

Stefan Koch uplink.coder at googlemail.com
Mon May 25 19:54:55 UTC 2020


On Monday, 25 May 2020 at 17:34:36 UTC, Timon Gehr wrote:
> On 25.05.20 19:25, Stefan Koch wrote:
>> On Monday, 25 May 2020 at 17:23:50 UTC, Timon Gehr wrote:
>>> [...]
>> 
>> Since Forwarding scopes where not in the language before you 
>> introduced static if.
>> Could you give a quick explanation how they work?
>> 
>
> It's a scope that forwards new symbols to its parent scope on 
> insertion. This way, each iteration of the `static foreach` 
> will have its own local scope with distinct loop variables, but 
> any declarations that are generated in the `static foreach` 
> body will skip this scope and instead populate the parent 
> scope. (As an experiment, the original implementation also had 
> `__local` declarations to insert symbols into the local scope 
> without forwarding.)

Thank a lot for the explanation!
I was wondering about this for a while.
That's a clever solution.


More information about the Digitalmars-d mailing list