Copying subvector makes pointer?

It’s still the case:

julia> x = [1,2,3];

julia> y = x;

julia> x[1] = 42;

julia> y
3-element Array{Int64,1}:
 42
  2
  3

To your original question, scalar indexing, i.e. b[1], (in contrast to slicing, i.e. b[1:2]) generally doesn’t create a copy. That’s why you see the behaviour you see. The “it doesn’t happen if I don’t have an array of arrays” part is due to the fact that the elements b[1] in this case are immutable numbers (in contrast to mutable arrays). Compare this to the example above:

julia> x = 4;

julia> y = x;

julia> x = 42;

julia> y
4
1 Like