Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
timholy opened this issue Jul 11, 2014 · 2 comments
Closed

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

timholy opened this issue Jul 11, 2014 · 2 comments

Comments

@timholy
Copy link
Sponsor Member

timholy commented Jul 11, 2014

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.

@JeffBezanson
Copy link
Sponsor Member

Although not quite the same, I think #3766 is more realistic. Running arbitrary code to derive the supertype of a type is a tall order.

@timholy
Copy link
Sponsor Member Author

timholy commented Jul 14, 2014

I wondered how one would even go about defining these, and figured that might be a problem. I'm going to close this in preference to #3766.

@timholy timholy closed this as completed Jul 14, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants