On Friday, October 23, 2015 at 9:08:55 PM UTC+2, Christoph Ortner wrote: > > > Apparently yes. For me it is very counterintuitive that this would be the > default behaviour. But presumably there was a lot of discussion that this > is desirable. > > (a) What are reasons, other than performance? >
I think this is the issue where this change was brought up: https://github.com/JuliaLang/julia/issues/3701 and the respective pull request is here: https://github.com/JuliaLang/julia/pull/9150 The main reason seems to be that Julia generally prefers reference-passing by default so this fits the language spirit. > (b) Is this still under discussion or pretty much settled? > > >From reading the issues, the core devs agree on the change and there wasn't a single objection so far. > (c) if I want to write code now that shouldn't break with 0.5, what should > I do? > I think when you need a copy, just surround your getindex with a copy function. (e.g. copy(x[:,10]) instead of x[:,10]). Regarding this change I am also more on the sceptical side. I would very much prefer a copy-on-write like solution like Matlab and R provide, but I don't know if and how this would be possible to implement, so I don't raise my voice here. To me the main benefit of this change is that it drove the main developers to make array views much more performant and first class members of julia. As Tim Holy mentioned, the actual change seems to be be very small, but it needed and still needs a lot of work to make it possible.