pureity of closures

Dicebot via Digitalmars-d digitalmars-d at puremagic.com
Mon Mar 30 06:18:42 PDT 2015


On Sunday, 29 March 2015 at 12:29:13 UTC, Stefan Koch wrote:
> On Friday, 27 March 2015 at 17:47:26 UTC, H. S. Teoh wrote:
>> What I'm more concerned about is whether the current compiler
>> implementation may accidentally allow leakage of the pure 
>> function's
>> internal context, which would break purity.
>>
>>
>> T
> please explain your reasoning with a bit of example code.
> I am not sure if I get where/when impurity would be introduced.

void delegate() metafoo() pure
{
     int x;
     return () { x = 42; }; // now stack frame of pure function
                            // is available externally
                            // no idea what may happen
}



More information about the Digitalmars-d mailing list