# Destructuring and broadcast

**URL:** <https://discourse.julialang.org/t/destructuring-and-broadcast/5672>\
**Category:** General Usage\
**Tags:** question\
**Created:** [September 1, 2017, 12:45pm UTC](https://discourse.julialang.org/t/destructuring-and-broadcast/5672 "2017-09-01T12:45:51Z")\
**Posts on this page:** 1\
**Showing post:** 5

<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 13, 2018, 7:07am UTC](https://discourse.julialang.org/t/destructuring-and-broadcast/5672/5 "2018-10-13T07:07:17Z")

</div>

In v0.6, I used StructsOfArrays to do broadcasting with tuple output:

```julia
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/destructuring-and-broadcast/5672)._
