> weaklypure void reverse(int[] x)
> {
>     for(int i = 0; i * 2 < x.length; i++)
>         swap(x[i], x[$-1-i]);
> }
> pure int foo(const(int)[] x)
> {
>      auto x2 = x.dup;
>      reverse(x2);
>      // do some calculation on x2
>      ...
>      return calculation;
> }

noglobal void reverse(MyClass x)
{
  x.text = "";
}

So weakly-pure should not access global stuff. But that is harder
to track by the compiler with mutable parameters.

Or weakly-pure is only noglobal when called in pure routines, because of the
immutable barrier.

Unwritten contract, not checked by the compiler?  (Like property getters 
shouldn't
modify the "state" of the object.)

Reply via email to