Default not working?
rveltz opened this issue · 2 comments
rveltz commented
Hi,
I expected this would work...
Can you explain why it does not please?
@with_kw struct A{T}
a::T = 1.0
end
@with_kw struct B{T,E}
a::E = A{T}()
end
B()
whereas A()
works.
Thank you for your very helpful package,
mauro3 commented
It cannot know what T
is. Your case only works when the type-paras are fully specified:
julia> B{Int,A{Int}}()
B{Int64,A{Int64}}
a: A{Int64}
I think you want:
julia> @with_kw struct BB{E}
a::E = A()
end
BB
julia> BB()
BB{A{Float64}}
a: A{Float64}
Does that help?
rveltz commented
I see....
Thank you!