Skip to content

Eliminate type piracy—add container <: AbstractArray types? #46

@anowacki

Description

@anowacki

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions