Skip to content

Conversation

@fredrikekre
Copy link
Member

I had these in my own code, might as well upstream them.

@timholy
Copy link
Member

timholy commented Jun 5, 2019

push! and pop! seem fine. With pushfirst!/popfirst!, my worry is that the natural thing to do would be to mutate the initial index, but we can't do that without making the wrapper mutable. (See https://github.com/JuliaArrays/CatIndices.jl/blob/master/src/bidirectional.jl.) If we accepted those and then someday got an API for mutating immutables and then decide we want to change how pushfirst! works, it becomes non-deprecatable breaking behavior. Of course we could do that (e.g., OffsetArrays v2.0.0), so that's not a killer argument. Nevertheless, I'm tempted to leave those out of this. Thoughts?

@fredrikekre
Copy link
Member Author

With pushfirst!/popfirst!, my worry is that the natural thing to do would be to mutate the initial index

Okay, that is not what pushfirst!(::Vector) does though?

@timholy
Copy link
Member

timholy commented Jun 5, 2019

Right, pushfirst! on a vector does not mutate the initial index. So we could say that this is just how pushfirst! works. I could agree to that.

OTOH Vector lies in that fuzzy world spanning both views of 1-d arrays, either "I'm just a list of elements" or "I'm an associative container with integer keys." pushfirst! seems to belong to the first world, but most uses of OffsetArrays are probably in that second world.

@fredrikekre
Copy link
Member Author

Alright, I dropped (push|pop)first! for now at least.

@fredrikekre
Copy link
Member Author

bump.

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.

2 participants