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

Compute supertype parameters #7

Open
Oblynx opened this issue Mar 30, 2019 · 3 comments
Open

Compute supertype parameters #7

Oblynx opened this issue Mar 30, 2019 · 3 comments

Comments

@Oblynx
Copy link

Oblynx commented Mar 30, 2019

I experimented with the following behavior, which is not supported by this package:

struct CustomArray{N1,N2} <: AbstractArray{Int, N1+N2}
  ...
end

The intent is to define 2 different kinds of dimensions for the array, which have a semantic difference. There is of course the same workaround of explicitly passing the expression N1+N2 as a 3rd type parameter.

Please consider this as a feature request, if this use case is convincing.

@vtjnash
Copy link
Owner

vtjnash commented Mar 30, 2019

Sure, that’s well in line with what this package already does, and just needs to be added to the syntax rules.

@richardreeve
Copy link

On a related note, I’d really like to be able to do this:

abstract type SuperT{A} end
@computed struct SubT{B} <: SuperT{f(B)}
  b::B
end

At the moment this errors as f is not defined, or works incorrectly with existing functions like eltype since eltype is defined on Any...

@wsshin
Copy link

wsshin commented Jan 13, 2022

Another related capability I would like:

@computed struct MyType{N,V<:AbstractArray{N+2}}
    a::V
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants