When object are combined in an array, it's better when their parametric types are the same, so I probably should not make type parameters these types that vary between chains (Recoupling, Lineshape)
This works better,
@with_kw struct ChainΛb2Λγ <: AbstractDecayChain
Xlineshape::AbstractLineShape
two_j::Int
HRk::Recoupling
Hij::Recoupling
end
Reason:
I am finding that Julia does not do inference of the complex parametric types well.
Does julia give up nesting types when reaching certain depth? - I cannot reproduce it with basic types, but I noticed that my customary type information is lost
MWE
using StaticArrays
# Here is my customary parametric tyoe
abstract type AbstractDecayChain end
struct Chain{T<:Real} <: AbstractDecayChain
a::T
end
ch = SVector(Chain(1), Chain(2.0), Chain(1//2))
typeof(ch) # SVector{3, Chain}}
N = length(ch)
# fully inferred
x = 1:N .=> zip((string.(1:N) .=> zip(1:N, Float64.(1:N))), 1:N) # Vector{Pair{Int64, Tuple{Pair{String, Tuple{Int64, Float64}}, Int64}}}
# parametric type is dropped
y = 1:N .=> zip((string.(1:N) .=> zip(1:N, Float64.(1:N))), ch) # Vector{Pair{Int64}}
y isa Vector{Pair{Int64, T} where T} # true
When object are combined in an array, it's better when their parametric types are the same, so I probably should not make type parameters these types that vary between chains (Recoupling, Lineshape)
This works better,
Reason:
I am finding that Julia does not do inference of the complex parametric types well.
Does julia give up nesting types when reaching certain depth? - I cannot reproduce it with basic types, but I noticed that my customary type information is lost
MWE