Why @view add a "true &&" before the view call?

This will probably be changing, see https://github.com/JuliaLang/julia/pull/36780.

The comment says

# wrap in a let block to prevent accidentally redefining `view` if used on the LHS, e.g.
#   @view(A[x]) = 2

Before the proposed change it was not a let block, but true &&, which had the same effect: To not redefine view by accident:

julia> view(A, :, a) = b
view (generic function with 1 method)
3 Likes