Accessors.jl
Accessors.jl copied to clipboard
`set(arr, reverse, arr2)` can change size
Allow reversed objects to change size. E.g.
julia> @modify([10,20,30]) do xs
xs[2:3]
end
2-element Vector{Int64}:
20
30
Resolves #212.
Thanks for trying it out @jariji!
It's not just KeyedArrays that need special handling after this PR. For example, StaticArrays now lose their "staticness" completely: set(SVector(1,2,3), reverse, 10:12) now returns a plain Vector without a static length.
Maybe there are even more cases like that... But even with 2 major "special cases", I'm personally not fully convinced this is the way to go.
But the extension issue itself is simple: you define a new set function that doesn't overload Accessors.set.