https://github.com/JuliaLang/julia/pull/9150
Until recently (julia 0.4), our SubArrays were not performant enough to make
this a viable option.
--Tim
On Tuesday, January 13, 2015 05:35:36 AM Sebastian Good wrote:
> Forgive what is probably and old discussion, but I am curious why array
> subscripts create copies of arrays instead of views into them. Given
>
> julia> a = [1:3 1:3];
>
> I can mutate a whole column of the array in place by saying
>
> julia> a[:,2] = [4:6];
> julia> a
> 3x2 Array{Int64,2}:
> 1 4
> 2 5
> 3 6
>
> But my sense of referential transparency is violated because I can't
> further mutate that this way
>
> julia> a[:,2][1] = 10;
> julia> a
> 3x2 Array{Int64,2}:
> 1 4
> 2 5
> 3 6
>
> I can achieve mutable sub-views with the sub function
>
> julia> sub(a, :, 2)[1] = 10;
> julia> a
> 3x2 Array{Int64,2}:
> 1 10
> 2 5
> 3 6
>
> Why the difference? Why not make [] syntax sugar for sub? (As () will be
> for call in 0.4)