On Tuesday, 23 September 2014 at 09:17:48 UTC, bearophile wrote:
Marc Schütz:
http://wiki.dlang.org/User:Schuetzm/scope
If a mutable argument of a function is tagged as unique, the
type system guarantees that there are no other references to
it. So can a function 'foo' like this be "strongly pure"?
int[] foo(unique int[] a) pure {
a[0]++;
return a;
}
I think so. But note that `unique` is not part of my proposal, I
merely used it in the example. I think it could be implemented
relatively easily, because DMD internally already has a concept
of uniqueness that is used for converting things to immutable
implicitly. But this would be a different proposal.