# Array slices as views - what's the state of affairs?

**URL:** <https://discourse.julialang.org/t/array-slices-as-views-whats-the-state-of-affairs/1169>\
**Category:** Internals & Design\
**Created:** [December 27, 2016, 10:33pm UTC](https://discourse.julialang.org/t/array-slices-as-views-whats-the-state-of-affairs/1169 "2016-12-27T22:33:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dfdx](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dfdx/32/120_2.png) [@dfdx](https://discourse.julialang.org/u/dfdx)\
**Post date:** [December 27, 2016, 10:33pm UTC](https://discourse.julialang.org/t/array-slices-as-views-whats-the-state-of-affairs/1169/1 "2016-12-27T22:33:23Z")

</div>

I remember a long, long discussion about making array slices (i.e. `A[:, :]` syntax) to produce a view instead of a copy, but it turns out to be terribly hard to find a related thread. Can somebody point to it or describe a final status? In particular:

1. Is this idea finally rejected or things may still change?
2. What about special syntax? IIRC, `A@[:, :]` was mentioned in some announce, but I don’t see it working on a nightly build of 0.6.
3. Any optimizations on compiler level? E.g. when a slice is proved to be read-only and underlying array to be unmodified during slice lifetime?

---

<div class="post-metadata">

**Author:** ![mbauman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mbauman/32/31082_2.png) [@mbauman](https://discourse.julialang.org/u/mbauman)\
**Post date:** [December 27, 2016, 10:43pm UTC](https://discourse.julialang.org/t/array-slices-as-views-whats-the-state-of-affairs/1169/2 "2016-12-27T22:43:20Z")

</div>

Most of the discussion occurred on the umbrella Arraypocalypse issue. Most saliently, see this comment: [https://github.com/JuliaLang/julia/issues/13157#issuecomment-221294186](https://github.com/JuliaLang/julia/issues/13157#issuecomment-221294186)

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [January 20, 2017, 10:07pm UTC](https://discourse.julialang.org/t/array-slices-as-views-whats-the-state-of-affairs/1169/3 "2017-01-20T22:07:13Z")

</div>

I have a PR so that you can just put `@views` in front of a whole block of code, even a whole function, to opt-in to slices=views: [https://github.com/JuliaLang/julia/pull/20164](https://github.com/JuliaLang/julia/pull/20164)
