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

Should setindex(x::AbstractArray, v, i) support arbitrary indices? #17

Closed
tkf opened this issue Jul 31, 2019 · 1 comment · Fixed by #20
Closed

Should setindex(x::AbstractArray, v, i) support arbitrary indices? #17

tkf opened this issue Jul 31, 2019 · 1 comment · Fixed by #20

Comments

@tkf
Copy link
Member

tkf commented Jul 31, 2019

https://github.com/JuliaDiffEq/ArrayInterface.jl/blob/c8513cbc0b9dc24e6674206255838abec553b854/src/ArrayInterface.jl#L22-L26

Why not remove type restriction from Base.setindex like this?

function Base.setindex(x::AbstractArray, v, I...)
  _x = copy(x)
  _x[I...] = v
  _x
end
@ChrisRackauckas
Copy link
Member

yeah we should. We should also specialize lower dimensions so it's not assuming mutability, or at least specialize on Tracker.

tkf added a commit to tkf/ArrayInterface.jl that referenced this issue Aug 1, 2019
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 a pull request may close this issue.

2 participants