On Monday, 30 March 2015 at 13:18:44 UTC, Dicebot wrote:
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
}
Hmmm... Where's the (conceptual) difference to this:
struct S {
int x;
void foo() pure {
x = 42;
}
}
S* metafoo() pure {
auto s = new S;
return s;
}
Why should your example be impure?