I can implement the next code:
struct data
p::NamedTuple{(:a,:b,:c,:d,:e), Tuple{Symbol,Bool,Any,Any,Any}}
end
q1 = data((a=:n,b=true,c="one",d=1,e=1.2))
q2 = data((a=:n,b=false,c="one",d=3.5,e=nothing))
#I get
julia> typeof(q1.p)
NamedTuple{(:a, :b, :c, :d, :e),Tuple{Symbol,Bool,Any,Any,Any}}
typeof(q2.p)
NamedTuple{(:a, :b, :c, :d, :e),Tuple{Symbol,Bool,Any,Any,Any}}
(a) How can I group the structure types without using abstract types? I am hoping to get:
# Expected result
julia> typeof(q1.p)
NamedTuple{(:a, :b, :c, :d, :e),Tuple{Symbol,Bool,String,Int64,Float64}}
julia> typeof(q2.p)
NamedTuple{(:a, :b, :c, :d, :e),Tuple{Symbol,Bool,String,Float64,Nothing}}
(b) Is there any way to define only the first two parameters?
struct data
p::NamedTuple{(:a,:b,:c,:d,:e), Tuple{Symbol,Bool,...}}
end