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

AbstractRNG should be a broadcast scalar #31071

Closed
stevengj opened this issue Feb 14, 2019 · 4 comments · Fixed by #33213
Closed

AbstractRNG should be a broadcast scalar #31071

stevengj opened this issue Feb 14, 2019 · 4 comments · Fixed by #33213
Labels
broadcast Applying a function over a collection good first issue Indicates a good issue for first-time contributors to Julia

Comments

@stevengj
Copy link
Member

As mentioned on the mailing list, we need a

Base.broadcastable(x::AbstractRNG) = Ref(x)

somewhere.

Not breaking since trying to a broadcast an RNG currently gives an error.

@stevengj stevengj added good first issue Indicates a good issue for first-time contributors to Julia broadcast Applying a function over a collection labels Feb 14, 2019
@JeffBezanson
Copy link
Member

I think we have too many of these definitions already. At a certain point it's just better to be explicit. It's not obvious, for example, whether an RNG is iterable.

@stevengj
Copy link
Member Author

It's not obvious, for example, whether an RNG is iterable.

Why would an RNG be iterable? This seems like one of those things that will never have a length.

@JeffBezanson
Copy link
Member

It's just that an RNG is an obscure enough object that being explicit seems acceptable to me.

@stevengj
Copy link
Member Author

stevengj commented Feb 14, 2019

My feeling is that every documented type that is unambiguously not sensible to treat as a collection should implement Base.broadcastable(x::Foo) = Ref(x).

Is there a downside to having "too many" such broadcastable definitions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
broadcast Applying a function over a collection good first issue Indicates a good issue for first-time contributors to Julia
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants