Memory allocation while using @views

I don’t think @views makes the LHS of an assignment like += into a view:

 @macroexpand @views a[:] += b[:]

:(let var"##a#296" = a, var"##i#297" = (:)
      var"##a#296"[var"##i#297"] = (Base.maybeview)(var"##a#296", var"##i#297") + (Base.maybeview)(b, :)
  end)

This is especially easier for updating operations like .+= , where you can’t put view on the left-hand side (as discussed on discourse).

1 Like