Array + scalar deprecation

The Deprecated section of Julia v0.7.0 Release Notes says:

“Automatically broadcasted + and - for array + scalar, scalar - array, and so-on
have been deprecated due to inconsistency with linear algebra.
Use .+ and .- for these operations instead.”

  1. I do not find the issue # for this.
    Could you point me to there?

  2. Do I remember correctly that this already happened once,
    but then it was reverted?

PR: https://github.com/JuliaLang/julia/pull/22932
Issue: Deprecate broadcast behaviour of `+` in favour of adding identity matrices · Issue #22880 · JuliaLang/julia · GitHub

1 Like

This post links to the previous, reverted attempt: https://github.com/JuliaLang/julia/pull/22932#issuecomment-318084324

(You can look at the NEWS.md with blame to find out which commit added the news-item: https://github.com/JuliaLang/julia/blame/d14843749a57c880a64689673fe7317bd721747c/NEWS.md#L598)

1 Like

Thanks for the pointers.
They contained what I was looking for:
https://github.com/JuliaLang/julia/pull/7226

As I commented in the later PR, what changed is that

now we’ve eliminated most of the implicit broadcasting in favor of dot calls, and dot calls have some performance advantages (when they are combined) so it is not merely a matter of spelling.

I am sure that all aspects were considered well,
and decision time is over.

It is only that typing A.+1 instead of A+1
is not growing on me without a pain.

Unlike Julia 0.5, you now also have to write sqrt.(A) and exp.(A) for the elementwise functions. See this blog article for why we dropped the implicit elementwise syntax.