Inner constructors with parametric types, can't seem to get them to work for me

Your inner constructor defines a method with type parameters in the signature (the { ... } part). Unless you really need it, I would recommend just using types from the call signature. Also, you don’t need to store the type T in a slot b explicitly. I would do something like this instead:

struct Test{T, N, A} <: AbstractArray{T, N}
    a::Dict{NTuple{N, Int}, String}
    c::A
    d::Array{T, 2}
    function Test(::Type{T}, a::Dict{NTuple{N,Int},String}, c::A) where {T, N, A}
        new{T,N,A}(a, c, Array{T}(undef, 10, 10))
    end
end

# this works, but printing fails because you need to define a method 
# for `getindex` and `size` so that # `show` works, or alternatively 
# define the latter
z = Test(Float64, Dict((1,2,3,4)=>"test"), 6);
3 Likes