My point is it's just notation. `M[:,2]` is notation for `getindex(M, :, 2)`, which returns a copy. `slice(M, :, 2)` returns a view. In julia 0.5, `M[:,2]` will effectively become notation for `slice(M, :, 2)`.
So we're talking about a difference of 6 characters. I know syntax is important, and that as heavily as arrays are used, 6 characters may not be trivial. (More importantly, the lack of bounds checking is not to be dismissed.) Still, it's worth distinguishing between "how many keystrokes do I have to type?" and "what functionality exists today?"---those are two very different questions. --Tim On Friday, October 23, 2015 11:48:31 AM Neal Becker wrote: > Tim Holy wrote: > > This will be a ridiculous charicature, but this issue has come up so many > > times that I think a little charicaturization is timely. > > > > With regards to arrays and views, the "big change" in julia 0.5 will > > > > essentially be a 1-line change: > > getindex(A, indexes...) = slice(A, indexes...) > > > > Since slice is already in base, you can use it today :-). > > > > There's much more to it than that: SubArrays don't always check bounds, so > > currently this is At Your Own Risk. There are some difficulties in > > reshaping SubArrays. > > > > But if the fundamental question is, "can I have performant and very > > flexible views?" the answer is: you already have them. > > > > Best, > > --Tim > > To be more precise, I'm coming from python/numpy. There, a native slice: > M[1:,2:] for example > returns a view, not a copy. As does a strided view: > M[::2] > I like this design. Does julia do this now, or does it plan to in the > future?
