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

Let LinearIndices(::Broadcasted) return LinearIndices #37186

Merged
merged 1 commit into from
Aug 25, 2020

Conversation

martinholters
Copy link
Member

@martinholters martinholters commented Aug 25, 2020

Ref https://github.com/JuliaLang/julia/pull/31020/files#r475669025. Not that it has caused me any trouble, but a constructor that returns an instance of another type than requested does have the potential for nasty surprises. And here, I don't think there is any advantage in not returning a LinearIndices ... but I don't know my ways around the broadcast code, so I might be wrong. While at it, this generalizes the definition to arbitrary Broadcasted.

Copy link
Member

@tkf tkf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I think making sure that LinearIndices returns LinearIndices is definitely an improvement.

But I think it'd be better to be conservative here and keep {<:Any,<:Tuple{Any}} because of the reason I mentioned.

base/broadcast.jl Show resolved Hide resolved
base/broadcast.jl Show resolved Hide resolved
@tkf tkf merged commit bf32ea4 into master Aug 25, 2020
@tkf tkf deleted the mh/linearindices-broadcasted branch August 25, 2020 20:01
simeonschaub pushed a commit to simeonschaub/julia that referenced this pull request Aug 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants