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

Reply via email to