# Difference between @view and view

**URL:** https://discourse.julialang.org/t/difference-between-view-and-view/40798
**Category:** General Usage
**Created:** [June 5, 2020, 8:46am UTC](https://discourse.julialang.org/t/difference-between-view-and-view/40798 "2020-06-05T08:46:28Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![sparrowhawk](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sparrowhawk/32/9148_2.png) [@sparrowhawk](https://discourse.julialang.org/u/sparrowhawk)
#### Post date: [June 5, 2020, 8:46am UTC](https://discourse.julialang.org/t/difference-between-view-and-view/40798/1 "2020-06-05T08:46:28Z")

</div>

If `A = [1,2; 3 4]` What is the difference between `b = view(A, :, 1)` and `b = @view A[:,1]`

Is the macro form just shorthand for the other?

Thanks

---

<div class="post-metadata">

### Author: ![mauro3](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mauro3/32/292_2.png) [@mauro3](https://discourse.julialang.org/u/mauro3)
#### Post date: [June 5, 2020, 8:53am UTC](https://discourse.julialang.org/t/difference-between-view-and-view/40798/2 "2020-06-05T08:53:31Z")

</div>

Yes, just for convenience. Also, the macro supports using `end`.

(There is also `@views`)

---

<div class="post-metadata">

### Author: ![nilshg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nilshg/32/2283_2.png) [@nilshg](https://discourse.julialang.org/u/nilshg)
#### Post date: [June 5, 2020, 9:27am UTC](https://discourse.julialang.org/t/difference-between-view-and-view/40798/3 "2020-06-05T09:27:38Z")

</div>

The way to check this is to use `@macroexpand`, which shows you what the macro expands to:

```julia
julia> using MacroTools # makes the output a bit cleaner

julia> @macroexpand( @view A[:, 1] )
:(true && (view)(A, :, 1))

```
