# recent broadcast changes (iterate by default), scalar struct, and \`@.\`

**URL:** https://discourse.julialang.org/t/recent-broadcast-changes-iterate-by-default-scalar-struct-and/11178
**Category:** Internals & Design
**Tags:** broadcast
**Created:** [May 27, 2018, 3:48am UTC](https://discourse.julialang.org/t/recent-broadcast-changes-iterate-by-default-scalar-struct-and/11178 "2018-05-27T03:48:05Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![rdeits](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rdeits/32/286_2.png) [@rdeits](https://discourse.julialang.org/u/rdeits)
#### Post date: [May 27, 2018, 5:40am UTC](https://discourse.julialang.org/t/recent-broadcast-changes-iterate-by-default-scalar-struct-and/11178/2 "2018-05-27T05:40:31Z")

</div>

Because `@.` is a syntax-level transformation, it doesn’t treat `Ref` as a special case in any way. So your

```julia
@. chi(Ref(m1), energy)

```

becomes

```julia
chi.(Ref.(m1), energy)

```

which does indeed try to call `chi(Ref(m1), e)` for each `e` in `energy` and thus produces the error you’re seeing.

If you don’t use `@.`, then the `Ref` works fine:

```julia
julia> chi.(Ref(m1), energy)
3-element Array{Float64,1}:
 0.6666666666666666
 0.5               
 0.4 

```

But I agree that the deprecation warning isn’t very helpful in this case, and you probably won’t be the only person to encounter this issue.

I’m not sure what could be done here. Using a 1-element tuple instead of a Ref also fixes the warning and works fine with `@.`:

```julia
julia> @. chi((m1,), energy)
3-element Array{Float64,1}:
 0.6666666666666666
 0.5               
 0.4 

```

Perhaps we should be recommending that instead?

---

_[View the full topic](https://discourse.julialang.org/t/recent-broadcast-changes-iterate-by-default-scalar-struct-and/11178)._
