beacon-biosignals / DataFrameIntervals.jl

Utilities for working with DataFrames of `Intervals.jl` or `TimeSpans.jl` objects.
MIT License
6 stars 1 forks source link

Indexing Style #10

Closed palday closed 2 years ago

palday commented 2 years ago

https://github.com/beacon-biosignals/DataFrameIntervals.jl/blob/eb7df5fd5ed815cf3208ac3c0557f7df87cf1d19/src/DataFrameIntervals.jl#L23

Should probably be

Base.IndexStyle(::Type{<:IntervalArray{A}) where {A} = IndexStyle(A)

Because you allow A <: AbstractVector, so A might not have linear indexing. If you want to restrict A to linear indexing, then you need an inner constructor that checks that.

haberdashPI commented 2 years ago

In this case the array is always a vector, so aren't the two styles effectively identical (in terms of performance profile)?

palday commented 2 years ago

StarWarsArrays.jl

haberdashPI commented 2 years ago

😂 okay... got it. We can't assume that the base defined index styles are the only ones that can be used.