On Mar 27, 11 22:30, bearophile wrote:
In Bugzilla I have proposed that if you call a pure function and you don't 
assign its return value, then you have a bug, like the similar present in D for 
unassigned expressions.

This should be restricted to *strongly* pure functions. Weakly pure functions may have its major effect sent out via the input arguments, so ignoring the return value could make sense.

  import std.stdio;

  pure double[] set(double[] x, int index, double e) {
    x[index] = e;
    return x;
  }

  void main () {
    auto j = new double[](3);
    j.set(0, 1.5).set(1, 2.5).set(2, 5.1);
    writeln(j);
  }

BTW, which Bugzilla entry you are talking about?

Reply via email to