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

Eliminate type piracy—add container `<: AbstractArray` types?

Open anowacki opened this issue 1 year ago • 1 comments

Seis.jl has always used getproperty (.-access) to get at and set nested properties of things like Array{<:Trace}s. This worked fine when (pre Julia v1.11) Array was implemented in C and the type didn't have Julia fields to access. Nonetheless, this has always been type piracy, and now this will cause invalidations.

In a future major breaking version of Seis.jl, we should stop committing type piracy and probably instead only enable .-access for new container array types which we own. This will require implementing the full AbtractArray and broadcasting interfaces on a type like:

struct TraceArray{T<:AbstractTrace,N} <: AbstractArray{T,N}
    traces::Array{T,N}
end

anowacki avatar Oct 11 '24 11:10 anowacki

Triggered by https://github.com/JuliaLang/julia/issues/56100

anowacki avatar Oct 11 '24 11:10 anowacki