Closure capture loop variables

deadalnix via Digitalmars-d digitalmars-d at puremagic.com
Fri May 1 14:42:21 PDT 2015


On Friday, 1 May 2015 at 17:51:05 UTC, Walter Bright wrote:
> On 4/30/2015 5:55 AM, Vladimir Panteleev wrote:
>> I think Freddy's programs are working as designed.
>
> Yes, they are.
>
> D closures capture variables by reference. No, we're not 
> changing that.

The variable is declared in the block, therefore it is a 
DIFFERENT variable at every iteration.

This or delegate are unable to respect constness/immutability.


More information about the Digitalmars-d mailing list