Expanding the horizons of D purity

H. S. Teoh hsteoh at quickfur.ath.cx
Thu Nov 7 09:41:05 PST 2013


On Thu, Nov 07, 2013 at 09:22:47PM +0400, Denis Shelomovskij wrote:
> 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:
[...]

It will not. My proposal only applies to weakly pure functions. Strongly
pure functions cannot call impure delegates because you cannot guarantee
anything about what the delegate will do.

So basically, once a pure function takes a non-pure delegate parameter,
it is no longer strongly pure, only weakly pure. (I stated this at the
end of my post where strongly pure functions are not allowed to call
impure delegates.)


T

-- 
Never trust an operating system you don't have source for! -- Martin Schulze


More information about the Digitalmars-d mailing list