ArrayInterface.jl icon indicating copy to clipboard operation
ArrayInterface.jl copied to clipboard

Should we have pop, push and friends?

Open Tokazama opened this issue 5 years ago • 2 comments
trafficstars

StaticArrays has all of these non-mutating versions of typically mutating methods implemented, which might be a good fit for this package since we have setindex. It would be nice if these were available outside of a dependency on StaticArrays and part of the general array interface.

Tokazama avatar Aug 30 '20 14:08 Tokazama

Out of curiosity, what do you think of BangBang.jl?

It maybe nice to try and support a more uniform interface, e.g. x = push!!(x, 2). Of course, the methods changing the data structure's length won't be type stable for anything typed by size.

I hope @tkf doesn't mind getting pinged here, in case he'd like to give feedback or suggestions on a general interface. Also because I wonder if this would be somewhat of a fracturing of these sorts of methods between ArrayInterface and BangBang.

chriselrod avatar Sep 01 '20 05:09 chriselrod

Ive always liked the syntax of BangBang but have never ended up using it. It might become more convenient as Julia gets more immutable collections though.

I also don't see what other possible meaning that syntax could reasoanably have, so it seems like a pretty safe thing to commit to if we moved forward with it.

Tokazama avatar Sep 01 '20 12:09 Tokazama