# Is there an API to get a Broadcasted object from a dotted expression without materialization?

**URL:** <https://discourse.julialang.org/t/is-there-an-api-to-get-a-broadcasted-object-from-a-dotted-expression-without-materialization/19339>\
**Category:** General Usage\
**Created:** [January 6, 2019, 11:36pm UTC](https://discourse.julialang.org/t/is-there-an-api-to-get-a-broadcasted-object-from-a-dotted-expression-without-materialization/19339 "2019-01-06T23:36:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tkf](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tkf/32/17635_2.png) [@tkf](https://discourse.julialang.org/u/tkf)\
**Post date:** [January 6, 2019, 11:36pm UTC](https://discourse.julialang.org/t/is-there-an-api-to-get-a-broadcasted-object-from-a-dotted-expression-without-materialization/19339/1 "2019-01-06T23:36:09Z")

</div>

I’m looking for an API, say a macro `@broadcasted`, to do:

```julia
julia> bc = @broadcasted f.(a, g.(b, h.(c)))
Base.Broadcast.Broadcasted(....)

```

such that

```julia
julia> Base.materialize(bc) == f.(a, g.(b, h.(c)))
true

```

I guess I can write a macro myself using `Meta.lower`

```julia
julia> Meta.lower(@ __MODULE__ , :(f.(a, g.(b, h.(c)))))
:($(Expr(:thunk, CodeInfo(
1 ─ %1 = (Base.broadcasted)(h, c)
│ %2 = (Base.broadcasted)(g, b, %1)
│ %3 = (Base.broadcasted)(f, a, %2)
│ %4 = (Base.materialize)(%3)
└── return %4
))))

```

But I thought I’d ask first if there already is an API or a better approach to do this.

---

<div class="post-metadata">

**Author:** ![mbauman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mbauman/32/31082_2.png) [@mbauman](https://discourse.julialang.org/u/mbauman)\
**Post date:** [January 7, 2019, 2:43am UTC](https://discourse.julialang.org/t/is-there-an-api-to-get-a-broadcasted-object-from-a-dotted-expression-without-materialization/19339/2 "2019-01-07T02:43:01Z")

</div>

Not yet.

[https://github.com/JuliaLang/julia/issues/19198](https://github.com/JuliaLang/julia/issues/19198)

---

<div class="post-metadata">

**Author:** ![tkf](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tkf/32/17635_2.png) [@tkf](https://discourse.julialang.org/u/tkf)\
**Post date:** [January 7, 2019, 3:07am UTC](https://discourse.julialang.org/t/is-there-an-api-to-get-a-broadcasted-object-from-a-dotted-expression-without-materialization/19339/3 "2019-01-07T03:07:11Z")

</div>

Thanks!
