# Array + scalar deprecation

**URL:** <https://discourse.julialang.org/t/array-scalar-deprecation/7214>\
**Category:** General Usage\
**Created:** [November 21, 2017, 8:07am UTC](https://discourse.julialang.org/t/array-scalar-deprecation/7214 "2017-11-21T08:07:58Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![turtle](https://avatars.discourse-cdn.com/v4/letter/t/ecb155/32.png) [@turtle](https://discourse.julialang.org/u/turtle)\
**Post date:** [November 21, 2017, 8:07am UTC](https://discourse.julialang.org/t/array-scalar-deprecation/7214/1 "2017-11-21T08:07:58Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![fredrikekre](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fredrikekre/32/1688_2.png) [@fredrikekre](https://discourse.julialang.org/u/fredrikekre)\
**Post date:** [November 21, 2017, 8:16am UTC](https://discourse.julialang.org/t/array-scalar-deprecation/7214/2 "2017-11-21T08:16:38Z")

</div>

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

> [@turtle](#):
>
> Do I remember correctly that this already happened once, but then it was reverted?

> <https://github.com/JuliaLang/julia/pull/22932#issuecomment-318084324>
>
> Previous attempt was: #5807, #5810, reverted in #7226.
> 
> The main difference, a…s @andyferris says, 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.

---

<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:** [November 21, 2017, 8:22am UTC](https://discourse.julialang.org/t/array-scalar-deprecation/7214/3 "2017-11-21T08:22:44Z")

</div>

This post links to the previous, reverted attempt: [https://github.com/JuliaLang/julia/pull/22932#issuecomment-318084324](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](https://github.com/JuliaLang/julia/blame/d14843749a57c880a64689673fe7317bd721747c/NEWS.md#L598))

---

<div class="post-metadata">

**Author:** ![turtle](https://avatars.discourse-cdn.com/v4/letter/t/ecb155/32.png) [@turtle](https://discourse.julialang.org/u/turtle)\
**Post date:** [November 21, 2017, 8:26am UTC](https://discourse.julialang.org/t/array-scalar-deprecation/7214/4 "2017-11-21T08:26:18Z")

</div>

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

---

<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:** [November 21, 2017, 6:34pm UTC](https://discourse.julialang.org/t/array-scalar-deprecation/7214/5 "2017-11-21T18:34:23Z")

</div>

As I [commented in the later PR](https://github.com/JuliaLang/julia/pull/22932#issuecomment-318084324), 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.

---

<div class="post-metadata">

**Author:** ![turtle](https://avatars.discourse-cdn.com/v4/letter/t/ecb155/32.png) [@turtle](https://discourse.julialang.org/u/turtle)\
**Post date:** [November 21, 2017, 7:01pm UTC](https://discourse.julialang.org/t/array-scalar-deprecation/7214/6 "2017-11-21T19:01:46Z")

</div>

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.

---

<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:** [November 21, 2017, 7:13pm UTC](https://discourse.julialang.org/t/array-scalar-deprecation/7214/7 "2017-11-21T19:13:41Z")

</div>

Unlike Julia 0.5, you now also have to write `sqrt.(A)` and `exp.(A)` for the elementwise functions. See [this blog article](https://julialang.org/blog/2017/01/moredots) for why we dropped the implicit elementwise syntax.
