Am 31.05.2014 11:08, schrieb bearophile:
int foo(scope int[] items) @nogc {
    return foo.sum;
}

That was:

return items.sum;

Bye,
bearophile

Well obviously the std.algorithm sum would also be annoted with scope. Because it doesn't escape it either. I don't see the problem here. And in case you really want to escape it, you need to .dup it.

A additional advantage of my solution is, that the compiler can prove it to be @safe. Your solution does not allow that.

Kind Regards
Benjamin Thaut

Reply via email to