pureity of closures
Stefan Koch via Digitalmars-d
digitalmars-d at puremagic.com
Sun Mar 22 05:58:23 PDT 2015
dmd infers function closures impure if impure functions are
defined within them.
even if those are never called and can never be accessed outside
of the closure.
Example :
int a;
void closure() pure {
impure_function() {
a++;
}
}
t.d(4): Error: pure function 't.closure.impure_function' cannot
access mutable static data 'a'
is this intended ?
More information about the Digitalmars-d
mailing list