I’m sorry if this is a stupid question, but I could not find it in the docs (nor solve it myself). I have a type A
parametrized with a number N
. How can I make this work:
struct A{N}
x::Array{Float64, N-1}
y::Array{Float64, N}
end
The problem is of course the N-1
. Thanks in advance!
You can’t really make this work currently, but what you can do is something like this:
struct A{M,N}
x::Array{Float64, M}
y::Array{Float64, N}
# inner constructor that checks that `M == N-1`
end
1 Like
You can do it with my forked version of ComputedFieldTypes
, for which I have a pull-request updating 1.0
vtjnash:master
← chakravala:master
opened 10:24PM - 08 Dec 18 UTC
don't know if I fixed all the possible issues, but I did update the code based o… n the examples in the README to use the `where` syntax for compatibility with Julia 1.0
Would be good to have this as a registered package, is it going to be registered?
I would like to use this for a package which I will register.
An example of it in action is Grassmann.jl I hope it gets registered soon
1 Like
This is a feature we could add eventually; see https://github.com/JuliaLang/julia/issues/18466 .
2 Likes
Thanks all for the useful replies!