On 6/17/11 1:56 AM, Kagamin wrote:
Andrei Alexandrescu Wrote:

This has sparked an interesting discussion, to which I added my
bit.

int fun(int a) pure { if (a>  10) writeln("I'm impure); }

As I understand, even if some calls to a function have some
repeatability properties, this doesn't mean the function is pure. In
this example fun is obviously impure. Here one can talk about
allowing to call impure functions from pure ones, but that's a way
different task.

Right. I gave that example within the context of the discussion, which considered purity a path-sensitive property. By that definition, if fun is provably never invoked with a > 10, then it's effectively pure.

Andrei

Reply via email to