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

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

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

such that

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

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

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.

1 Like

Not yet.

https://github.com/JuliaLang/julia/issues/19198

2 Likes

Thanks!