Thanks for the kind explanations and references that I had missed, seems 
clear to me now.

As a footnote, I was looking for a way to enforce Matlab-like behaviour, 
that is changing the contents of an array argument inside a function is 
invisible to the caller.

Unsuccessful attempt:

function f!(x)
x=x         #  <== does not copy x, it seems to get optimized away
x[:]=x+1  #  <==  this is still visible to the caller
end

but 

function f(x)
x=copy(x)  # <== copies x in function scope, for numeric arrays x=x+0 works 
also
x{:]=x+1    # <== this is now invisible to the caller
end

Reply via email to