Expanding the horizons of D purity
Denis Shelomovskij
verylonglogin.reg at gmail.com
Thu Nov 7 09:22:47 PST 2013
01.11.2013 0:05, H. S. Teoh пишет:
> I'd like to propose extending the scope of weak purity one step further:
> allow weakly-pure functions to call (not necessarily pure) delegates
> passed as a parameter.
Unacceptable. It will break strongly purity. Your mistake is strongly
pure function can easily get an impure delegate:
---
int i;
struct S
{ void g() { ++i; } }
void impureCaller(scope void delegate() del) pure
{ del(); }
void f() pure // strongly pure, will modify `i`
{
S s;
impureCaller(&s.g);
}
---
So issues 11469 [1] & 11412 [2] are the only way I see to solve our
problems.
[1] http://d.puremagic.com/issues/show_bug.cgi?id=11469
[2] http://d.puremagic.com/issues/show_bug.cgi?id=11412
--
Денис В. Шеломовский
Denis V. Shelomovskij
More information about the Digitalmars-d
mailing list