On Wednesday, 29 January 2014 at 15:11:33 UTC, Cooler wrote:
Yes, that is how slices work in D. The following article
explains the "non-determinism" that you mention:
http://dlang.org/d-array-article.html
Ali
Thank you for the article.
Quotation from the article "It is a good idea to note in the
documentation how the passed in slice might or might not be
overwritten."
May be just prohibit at language level the case of fun3()
function, to do not allow unpredictable behavior?
It's not unpredictable, at least not more unpredictable then fun2.
Should we dissallow this two?
int[] a = [1,2,3,4];
b = a;
b ~= [5, 6, 7, 8];