Skip to content

Defining length and prod for TypeVars that happen to be tuple-of-Ints #7572

@timholy

Description

@timholy

I'm not sure if this is feasible, but when one is using a tuple-of-Ints as a parameter, it would be nice to be able to use length and prod work. Then one could have deleted several type parameters from the definition of fixed-size arrays in #7568. For example, the definitions might have been

abstract AbstractFixedArray{T,SZ} <: DenseArray{T,length(SZ)}

immutable FixedArrayI{T,SZ} <: AbstractFixedArray{T,SZ}
    data::NTuple{prod(SZ),T}
end

immutable FixedArrayM{T,SZ} <: AbstractFixedArray{T,SZ}
    data::Array{T,length(SZ)}
end

saving 2 and 1 parameters, respectively.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions