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

Enabling dynamic and fixed indices.

Open Tokazama opened this issue 5 years ago • 2 comments

This came up on discourse. It's pretty important to have indices that are mutable for a lot of things methods to work (append!, push!, etc.), but there are times it's worth improving performance and losing mutating functions. I mentioned my work on StaticRanges.jl may be helpful. It provides mutable ranges as well with protective setproperty! methods so that users don't accidently make bizarre changes to a mutable range.

This could be as simple as:

const StaticIndicesRange{T,L} = Indices{T,OneToSRange{T,L}}
const DynamicIndicesRange{T} = Indices{T,OneToMRange{T}}
const FixedIndicesRange{T} = Indices{T,OneTo{T}}

If this is something you're interested in I'd be interested in further discussing how to implement it.

Tokazama avatar Dec 18 '19 10:12 Tokazama

Yes, once some ordering semantics of AbstractDictionary are resolved in #13 I don't see why we can't have array-like dictionaries with ranges as keys.

I don't think implementing this will be too hard - e.g. Indices can have tokens and lookup can defer to findfirst for AbstractArrays, we can set the issettable and isinsertable traits accordingly, or something like that... hmm...

andyferris avatar Jun 08 '20 23:06 andyferris

I'd ultimately like to incorporate this package into AxisIndices.jl so once #13 is in place I'd be happy to help out with the details of this.

Tokazama avatar Jun 09 '20 07:06 Tokazama