Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What's up with broadcasting over dictionaries and NamedTuple's is reserved #30836

Open
mauro3 opened this issue Jan 25, 2019 · 3 comments
Open
Labels
domain:broadcast Applying a function over a collection domain:collections Data structures holding multiple items, e.g. sets

Comments

@mauro3
Copy link
Contributor

mauro3 commented Jan 25, 2019

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 mauro3/Parameters.jl#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?

@mbauman
Copy link
Sponsor Member

mbauman commented Jan 25, 2019

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 #25904 and #5794.

@mbauman mbauman added the domain:broadcast Applying a function over a collection label Jan 25, 2019
@mauro3
Copy link
Contributor Author

mauro3 commented Jan 25, 2019

Sounds good. Thanks for the quick reply!

@jariji
Copy link
Contributor

jariji commented Sep 29, 2022

Based on the emojis, it looks like there's some consensus on broadcasting behavior for NamedTuples, so maybe it could be included in a future version.

@KristofferC KristofferC changed the title What's up with broadcasting over dictionaries and NamedTuples is reserved What's up with broadcasting over dictionaries and NamedTuple's is reserved Sep 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain:broadcast Applying a function over a collection domain:collections Data structures holding multiple items, e.g. sets
Projects
None yet
Development

No branches or pull requests

4 participants