On 9/23/14 7:11 AM, bearophile wrote:
Steven Schveighoffer:

int[] foo(unique int[] a) pure {
...
I don't think so. Strong pure function optimizations would not work
for something like:

auto x = foo(a) ~ foo(a);

This is similar to:

unique x1 = foo(a);
unique x2 = foo(a);
unique x = x1 ~ x2;

When the call to the first foo ends you have a x1 reference to the array
data. Such reference x1 is unique, so now 'a' is not usable any more,
you can't pass 'a' to foo once more.
I need to learn more about such stuff of linear typing.

This begs the question, what is the point of having "strong purity" if you can't optimize based on it?

-Steve

Reply via email to