I'm defining a large structure like this
struct A{T<:Number}
a::Matrix{T}
b::Int
c::Matrix{T}
end
In which I'd be happy to alias Matrix{T} to MT and limit this behavior in the scope of the definition. Simply I want to write code in the way of
struct A{T<:Number}
MT=Matrix{T}
a::MT
end
Can I make it within the current syntax?
This is tricky, since then it becomes harder to tell which statements specify field names. It also conflicts with possible default value syntax (#10146) (and with the existing @kwdef). So this seems unlikely.
FWIW, this does currently work:
julia> let
MT = Matrix{S} where S
struct A{T<:Number}
a::MT{T}
end
end
@vtjnash It's exactly what I want. It surprises me that the struct definition is kept outside the let scope. I've been thinking of this way but given up too early. Thank you.
Most helpful comment
FWIW, this does currently work: