# Multiple assignments using broadcasting - any hacks?

**URL:** <https://discourse.julialang.org/t/multiple-assignments-using-broadcasting-any-hacks/16592>\
**Category:** General Usage\
**Tags:** broadcast\
**Created:** [October 21, 2018, 4:21am UTC](https://discourse.julialang.org/t/multiple-assignments-using-broadcasting-any-hacks/16592 "2018-10-21T04:21:58Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![mohamed82008](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mohamed82008/32/18171_2.png) [@mohamed82008](https://discourse.julialang.org/u/mohamed82008)\
**Post date:** [October 21, 2018, 8:44am UTC](https://discourse.julialang.org/t/multiple-assignments-using-broadcasting-any-hacks/16592/3 "2018-10-21T08:44:16Z")

</div>

> [@Destructuring and broadcast](https://discourse.julialang.org/t/destructuring-and-broadcast/5672/5):
>
> In v0.6, I used StructsOfArrays to do broadcasting with tuple output: using StructsOfArrays T = Float64 TV = Vector{Float64} a = zeros(T, 10); b = copy(a) s = StructOfArrays{NTuple{2,T}, 1, Tuple{TV, TV}}((a, b)) f(a, b) = (a + b, a \* b) s .= f.(1:10, 1:10) A macro for the above should be simple enough. Figuring out T and TV and handling the case where a and b are not already allocated are the main challenges I can see.

---

_[View the full topic](https://discourse.julialang.org/t/multiple-assignments-using-broadcasting-any-hacks/16592)._
