The docs say
In Julia, all arguments to functions are passed by reference.
so I was quite surprised to see a difference in the behav
I think the document is a bit vague here.
Strictly speaking, Julia is "call-by-value where the value is a reference" , or "call-by-sharing", as used by most languages such as python, java, ruby, js... See wiki
A call by reference behaviour would indeed make foo!
to change the zeros to ones. However Julia doesn't support that. (If you know C#, that is what ref
or out
does)