Julia: What's up with `broadcasting over dictionaries and `NamedTuple`s is reserved`

Created on 25 Jan 2019  Â·  2Comments  Â·  Source: JuliaLang/julia

Is there a consensus on what to do about broadcasting named tuples and dicts? Currently (Julia 1.1):

julia> sin.((a=1,))
ERROR: ArgumentError: broadcasting over dictionaries and `NamedTuple`s is reserved

I'm asking because I'm pondering to make structs defined with @with_kw of Parameters.jl automatically not broadcast https://github.com/mauro3/Parameters.jl/issues/70. However, it would also be nice, if named tuples and dicts would work as drop-in for @with_kw structs. Thus, will they broadcast as scalars or as containers?

x-ref: #26212; add milestone?

broadcast collections

Most helpful comment

Hasn't been much development along these lines lately, but I know I'd be excited to see a behavior like #24019 which would broadcast functions over values and match keys.

I'd _not_ be excited about them broadcasting as scalars.

Edit: see also https://github.com/JuliaLang/julia/issues/25904 and https://github.com/JuliaLang/julia/issues/5794.

All 2 comments

Hasn't been much development along these lines lately, but I know I'd be excited to see a behavior like #24019 which would broadcast functions over values and match keys.

I'd _not_ be excited about them broadcasting as scalars.

Edit: see also https://github.com/JuliaLang/julia/issues/25904 and https://github.com/JuliaLang/julia/issues/5794.

Sounds good. Thanks for the quick reply!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

omus picture omus  Â·  3Comments

StefanKarpinski picture StefanKarpinski  Â·  3Comments

omus picture omus  Â·  3Comments

sbromberger picture sbromberger  Â·  3Comments

wilburtownsend picture wilburtownsend  Â·  3Comments